def test_configure_sriov_vf(self):
        """Test configuration of SR-IOV VF settings"""

        vf_config = [{"device_type": "vf", "device": {"name": "p2p1",
                      "vfid": 1}, "promisc": "on", "vlan_id": 101,
                      "qos": 5, "macaddr": "AA:BB:CC:DD:EE:FF",
                      "spoofcheck": "on", "state": "auto", "trust": "on",
                      "min_tx_rate": 0, "max_tx_rate": 100,
                      "name": "p2p1_1"}]
        exp_cmds = ["ip link set dev p2p1 vf 1 mac AA:BB:CC:DD:EE:FF",
                    "ip link set dev p2p1 vf 1 vlan 101 qos 5",
                    "ip link set dev p2p1 vf 1 min_tx_rate 0",
                    "ip link set dev p2p1 vf 1 max_tx_rate 100",
                    "ip link set dev p2p1_1 promisc on",
                    "ip link set dev p2p1 vf 1 spoofchk on",
                    "ip link set dev p2p1 vf 1 state auto",
                    "ip link set dev p2p1 vf 1 trust on"]
        run_cmd = []

        def run_ip_config_cmd_stub(*args, **kwargs):
            run_cmd.append(' '.join(args))
        self.stub_out('os_net_config.sriov_config.run_ip_config_cmd',
                      run_ip_config_cmd_stub)

        utils.write_yaml_config(common.SRIOV_CONFIG_FILE, vf_config)
        sriov_config.configure_sriov_vf()

        for cmd in exp_cmds:
            self.assertIn(cmd, run_cmd)
Esempio n. 2
0
def configure_sriov_vfs():
    logger.info("Configuring VFs now")
    sriov_config.configure_sriov_vf()
Esempio n. 3
0
def configure_sriov_vfs():
    logger.info("Configuring VFs now")
    sriov_config.configure_sriov_vf()
    nicpart_udev_rules_check()
Esempio n. 4
0
def configure_sriov_vfs():
    logger.info("Configuring VFs now")
    sriov_config.configure_sriov_vf()