~gnuoy/charms/trusty/nova-compute/resurrect-peer-relation

« back to all changes in this revision

Viewing changes to hooks/charmhelpers/contrib/network/ovs/__init__.py

  • Committer: james.page at ubuntu
  • Date: 2014-07-28 11:36:16 UTC
  • mfrom: (68.1.3 nova-compute)
  • Revision ID: james.page@ubuntu.com-20140728113616-spl81505m0q840sy
[corey.bryant,r=james-page] Add amulet tests

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
    subprocess.check_call(["ovs-vsctl", "--", "--if-exists", "del-br", name])
22
22
 
23
23
 
24
 
def add_bridge_port(name, port):
 
24
def add_bridge_port(name, port, promisc=False):
25
25
    ''' Add a port to the named openvswitch bridge '''
26
26
    log('Adding port {} to bridge {}'.format(port, name))
27
27
    subprocess.check_call(["ovs-vsctl", "--", "--may-exist", "add-port",
28
28
                           name, port])
29
29
    subprocess.check_call(["ip", "link", "set", port, "up"])
 
30
    if promisc:
 
31
        subprocess.check_call(["ip", "link", "set", port, "promisc", "on"])
 
32
    else:
 
33
        subprocess.check_call(["ip", "link", "set", port, "promisc", "off"])
30
34
 
31
35
 
32
36
def del_bridge_port(name, port):
35
39
    subprocess.check_call(["ovs-vsctl", "--", "--if-exists", "del-port",
36
40
                           name, port])
37
41
    subprocess.check_call(["ip", "link", "set", port, "down"])
 
42
    subprocess.check_call(["ip", "link", "set", port, "promisc", "off"])
38
43
 
39
44
 
40
45
def set_manager(manager):