def test_create_pxeboot_interface_network(self):
        controller_interface = dbutils.create_test_interface(
            ifname='enp0s8', forihostid=self.controller.id)
        worker_interface = dbutils.create_test_interface(
            ifname='enp0s8', forihostid=self.worker.id)

        controller_interface_network = dbutils.post_get_test_interface_network(
            interface_uuid=controller_interface.uuid,
            network_uuid=self.pxeboot_network.uuid)
        self._post_and_check(controller_interface_network, expect_errors=False)

        worker_interface_network = dbutils.post_get_test_interface_network(
            interface_uuid=worker_interface.uuid,
            network_uuid=self.pxeboot_network.uuid)
        self._post_and_check(worker_interface_network, expect_errors=False)
 def test_no_cluster_host_on_controller(self):
     worker_interface = dbutils.create_test_interface(
         ifname='enp0s3', forihostid=self.worker.id)
     worker_interface_network = dbutils.post_get_test_interface_network(
         interface_uuid=worker_interface.uuid,
         network_uuid=self.cluster_host_network.uuid)
     self._post_and_check(worker_interface_network, expect_errors=True)
 def test_create_invalid_network_on_data_interface(self):
     controller_interface = dbutils.create_test_interface(
         ifname='enp0s3',
         ifclass=constants.NETWORK_TYPE_DATA,
         forihostid=self.controller.id)
     controller_interface_network = dbutils.post_get_test_interface_network(
         interface_uuid=controller_interface.uuid,
         network_uuid=self.cluster_host_network.uuid)
     self._post_and_check(controller_interface_network, expect_errors=True)
 def test_aemode_invalid_mgmt(self):
     controller_interface = dbutils.create_test_interface(
         ifname='name',
         forihostid=self.controller.id,
         ifclass=constants.INTERFACE_CLASS_PLATFORM,
         iftype=constants.INTERFACE_TYPE_AE,
         aemode='balanced',
         txhashpolicy='layer2')
     controller_interface_network = dbutils.post_get_test_interface_network(
         interface_uuid=controller_interface.uuid,
         network_uuid=self.mgmt_network.uuid)
     self._post_and_check(controller_interface_network, expect_errors=True)
 def test_create_invalid_duplicate_networktype(self):
     controller_interface1 = dbutils.create_test_interface(
         ifname='enp0s3', forihostid=self.controller.id)
     dbutils.create_test_interface_network(
         interface_id=controller_interface1.id,
         network_id=self.oam_network.id)
     controller_interface2 = dbutils.create_test_interface(
         ifname='enp0s8', forihostid=self.controller.id)
     controller_interface_network = dbutils.post_get_test_interface_network(
         interface_uuid=controller_interface2.uuid,
         network_uuid=self.oam_network.uuid)
     self._post_and_check(controller_interface_network, expect_errors=True)
    def test_create_invalid_duplicate_mgmt_interface_network(self):
        controller_interface = dbutils.create_test_interface(
            ifname='enp0s8', forihostid=self.controller.id)
        dbutils.create_test_interface_network(
            interface_id=controller_interface.id,
            network_id=self.mgmt_network.id)

        worker_interface = dbutils.create_test_interface(
            ifname='enp0s8', forihostid=self.worker.id)
        dbutils.create_test_interface_network(interface_id=worker_interface.id,
                                              network_id=self.mgmt_network.id)

        controller_interface_network = dbutils.post_get_test_interface_network(
            interface_uuid=controller_interface.uuid,
            network_uuid=self.mgmt_network.uuid)
        self._post_and_check(controller_interface_network, expect_errors=True)

        worker_interface_network = dbutils.post_get_test_interface_network(
            interface_uuid=worker_interface.uuid,
            network_uuid=self.mgmt_network.uuid)
        self._post_and_check(worker_interface_network, expect_errors=True)