Wrapper method that adds table name and device to route statement
(self, dev, address)
| 61 | self.set_route(cmd) |
| 62 | |
| 63 | def add_network_route(self, dev, address): |
| 64 | """ Wrapper method that adds table name and device to route statement """ |
| 65 | # ip route add dev eth1 table Table_eth1 10.0.2.0/24 |
| 66 | table = self.get_tablename(dev) |
| 67 | |
| 68 | if not table or not address: |
| 69 | empty_param = "table" if not table else "address" |
| 70 | logging.info("Empty parameter received %s while trying to add network route, skipping" % empty_param) |
| 71 | else: |
| 72 | logging.info("Adding route: dev " + dev + " table: " + |
| 73 | table + " network: " + address + " if not present") |
| 74 | cmd = "throw %s table %s proto static" % (address, table) |
| 75 | self.set_route(cmd) |
| 76 | |
| 77 | def set_route(self, cmd, method="add"): |
| 78 | """ Add a route if it is not already defined """ |
no test coverage detected