Best Python code snippet using tempest_python
test_trunks_client.py
Source:test_trunks_client.py  
...106            bytes_body,107            200,108            trunk_id=self.FAKE_TRUNK_ID,109            **update_kwargs)110    def _test_add_subports_to_trunk(self, bytes_body=False):111        sub_ports = [{112            "port_id": "f04eb36-6c84-11eb-b0ab-4fc62961629d",113            "segmentation_type": "vlan",114            "segmentation_id": "1001"115        }]116        resp_body = copy.deepcopy(self.FAKE_TRUNKS["trunks"][0])117        resp_body["sub_ports"].append(sub_ports)118        self.check_service_client_function(119            self.trunks_client.add_subports_to_trunk,120            "tempest.lib.common.rest_client.RestClient.put",121            resp_body,122            bytes_body,123            200,124            trunk_id=self.FAKE_TRUNK_ID,125            sub_ports=sub_ports)126    def _test_delete_subports_from_trunk(self, bytes_body=False):127        fake_sub_ports = self.FAKE_TRUNKS['trunks'][0]['sub_ports']128        sub_ports = [129            {"port_id": fake_sub_ports[0]['port_id']}130        ]131        resp_body = copy.deepcopy(self.FAKE_TRUNKS["trunks"][0])132        resp_body['sub_ports'] = []133        self.check_service_client_function(134            self.trunks_client.delete_subports_from_trunk,135            "tempest.lib.common.rest_client.RestClient.put",136            resp_body,137            bytes_body,138            200,139            trunk_id=self.FAKE_TRUNK_ID,140            sub_ports=sub_ports)141    def test_create_trunk_with_str_body(self):142        self._test_create_trunk()143    def test_create_trunk_with_bytes_body(self):144        self._test_create_trunk(bytes_body=True)145    def test_list_trunks_with_str_body(self):146        self._test_list_trunks()147    def test_list_trunks_with_bytes_body(self):148        self._test_list_trunks(bytes_body=True)149    def test_show_trunk_with_str_body(self):150        self._test_show_trunk()151    def test_show_trunk_with_bytes_body(self):152        self._test_show_trunk(bytes_body=True)153    def test_update_trunk_with_str_body(self):154        self._test_update_trunk()155    def test_update_trunk_with_bytes_body(self):156        self._test_update_trunk(bytes_body=True)157    def test_add_subports_to_trunk_str_body(self):158        self._test_add_subports_to_trunk()159    def test_add_subports_to_trunk_bytes_body(self):160        self._test_add_subports_to_trunk(bytes_body=True)161    def test_delete_subports_from_trunk_str_body(self):162        self._test_delete_subports_from_trunk()163    def test_delete_subports_from_trunk_bytes_body(self):164        self._test_delete_subports_from_trunk(bytes_body=True)165    def test_delete_trunk(self):166        self.check_service_client_function(167            self.trunks_client.delete_trunk,168            "tempest.lib.common.rest_client.RestClient.delete",169            {},170            status=204,...trunks_client.py
Source:trunks_client.py  
...52        https://docs.openstack.org/api-ref/network/v2/index.html#list-trunks53        """54        uri = '/trunks'55        return self.list_resources(uri, **filters)56    def add_subports_to_trunk(self, trunk_id, sub_ports):57        """Add subports to a trunk.58        For a full list of available parameters, please refer to the official59        API reference:60        https://docs.openstack.org/api-ref/network/v2/index.html#add-subports-to-trunk61        """62        uri = '/trunks/%s/add_subports' % trunk_id63        put_data = {'sub_ports': sub_ports}64        return self.update_resource(uri, put_data)65    def delete_subports_from_trunk(self, trunk_id, sub_ports):66        """Deletes subports from a trunk.67        For a full list of available parameters, please refer to the official68        API reference:69        https://docs.openstack.org/api-ref/network/v2/index.html#delete-subports-from-trunk70        """...Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!
