(router_config, interfaces)
| 38 | |
| 39 | |
| 40 | def reconfigure_interfaces(router_config, interfaces): |
| 41 | for interface in interfaces: |
| 42 | cmd = "ip link show %s | grep ' state '" % interface.get_device() |
| 43 | for device in execute(cmd): |
| 44 | if " DOWN " in device: |
| 45 | cmd = "ip link set %s up" % interface.get_device() |
| 46 | # If redundant only bring up public interfaces that are not eth1. |
| 47 | # Reason: private gateways are public interfaces. |
| 48 | # configure_router.py and keepalived will deal with eth1 public interface. |
| 49 | |
| 50 | if router_config.is_redundant() and interface.is_public(): |
| 51 | state_cmd = STATE_COMMANDS[router_config.get_type()] |
| 52 | logging.info("Check state command => %s" % state_cmd) |
| 53 | state = execute(state_cmd)[0] |
| 54 | logging.info("Route state => %s" % state) |
| 55 | if interface.get_device() != PUBLIC_INTERFACES[router_config.get_type()] and state == "PRIMARY": |
| 56 | execute(cmd) |
| 57 | else: |
| 58 | execute(cmd) |
| 59 | |
| 60 | |
| 61 | def is_mounted(name): |
nothing calls this directly
no test coverage detected