def addOvsHybridVnic(domxml, iface, portId): setUpSecurityGroupVnic( iface.getElementsByTagName('mac')[0].getAttribute('address'), portId) brName = devName("qbr", portId) defineLinuxBridge(domxml, iface, portId, brName)
def test(): """Should print commands for: - qbrtest_port_i linux bridge - qvbtest_port_i veth attached to the bridge above - qvbtest_port_i matching veth attached to the br-int with portId 'test_port_id' and mac '00:1a:4a:16:01:51' """ import openstacknet_utils openstacknet_utils.executeOrExit = openstacknet_utils.mockExecuteOrExit openstacknet_utils.deviceExists = openstacknet_utils.mockDeviceExists setUpSecurityGroupVnic("00:1a:4a:16:01:51", 'test_port_id')
def main(): if PROVIDER_TYPE_KEY not in os.environ: return providerType = os.environ[PROVIDER_TYPE_KEY] pluginType = os.environ[PLUGIN_TYPE_KEY] if (providerType == OPENSTACK_NET_PROVIDER_TYPE and pluginType == PT_OVS and SECURITY_GROUPS_KEY in os.environ): domxml = hooking.read_domxml() portId = os.environ[VNIC_ID_KEY] iface = domxml.getElementsByTagName('interface')[0] mac = iface.getElementsByTagName('mac')[0].getAttribute('address') setUpSecurityGroupVnic(mac, portId)