MCPcopy Create free account
hub / github.com/apache/cloudstack / add_network_route

Method add_network_route

systemvm/debian/opt/cloud/bin/cs/CsRoute.py:63–75  ·  view source on GitHub ↗

Wrapper method that adds table name and device to route statement

(self, dev, address)

Source from the content-addressed store, hash-verified

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 """

Callers 1

post_config_changeMethod · 0.95

Calls 3

get_tablenameMethod · 0.95
set_routeMethod · 0.95
infoMethod · 0.45

Tested by

no test coverage detected