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

Function main

systemvm/debian/opt/cloud/bin/setup_tf_route.py:24–41  ·  view source on GitHub ↗
(argv)

Source from the content-addressed store, hash-verified

22
23
24def main(argv):
25 if len(argv) != 3:
26 exit(1)
27 pubip = argv[1]
28 prinet = argv[2]
29 pubdev = get_device(pubip)
30 if pubdev == "":
31 exit(1)
32 list = execute("ip -o -f inet addr show %s | awk '/scope global/ {print $4}'" % pubdev)
33 if len(list) != 1:
34 exit(1)
35 pubnet = list[0]
36 csroute = CsRoute()
37 csroute.add_table(pubdev)
38 csrule = CsRule(pubdev)
39 csrule.addRule("from %s to %s" % (pubnet, prinet))
40 cmd = "%s dev %s table %s" % (prinet, pubdev, csroute.get_tablename(pubdev))
41 csroute.set_route(cmd)
42
43
44if __name__ == '__main__':

Callers 1

setup_tf_route.pyFile · 0.70

Calls 9

add_tableMethod · 0.95
addRuleMethod · 0.95
get_tablenameMethod · 0.95
set_routeMethod · 0.95
CsRouteClass · 0.90
CsRuleClass · 0.90
exitFunction · 0.85
get_deviceFunction · 0.85
executeFunction · 0.50

Tested by

no test coverage detected