def configure_nics_for_sriov(self): vf_cmd = "ip link set {0} vf 0 mac {1}" for key, ports in self.networks.items(): vf_pci = [] host_driver = ports.get('driver') if host_driver not in self.drivers: self.connection.execute("rmmod %svf" % host_driver) self.drivers.append(host_driver) # enable VFs for given... build_vfs = "echo 1 > /sys/bus/pci/devices/{0}/sriov_numvfs" self.connection.execute(build_vfs.format(ports.get('phy_port'))) # configure VFs... mac = StandaloneContextHelper.get_mac_address() interface = ports.get('interface') if interface is not None: self.connection.execute(vf_cmd.format(interface, mac)) vf_pci = self.get_vf_data('vf_pci', ports.get('phy_port'), mac, interface) ports.update({ 'vf_pci': vf_pci, 'mac': mac }) LOG.info("Ports %s" % self.networks)
def configure_nics_for_ovs_dpdk(self): portlist = OrderedDict(self.networks) for key, ports in portlist.items(): mac = StandaloneContextHelper.get_mac_address() portlist[key].update({'mac': mac}) self.networks = portlist LOG.info("Ports %s" % self.networks)
def test_get_mac_address(self): status = StandaloneContextHelper.get_mac_address() self.assertIsNotNone(status)