@@ -142,7 +142,8 @@ def test_attach_detach_vnic(self):
142142 time .sleep (self .waittime )
143143 vn_ocid = self ._get_vnic_ocid (self .vnic_name )
144144 new_ipv4 = _get_ip_from_response (create_data )[0 ]
145- self .assertEqual (subprocess .check_output ([self .oci_net_config , 'detach-vnic' , '--ocid' , vn_ocid ]).decode ('utf-8' ), '' )
145+ detach_data = subprocess .check_output ([self .oci_net_config , 'detach-vnic' , '--ocid' , vn_ocid ]).decode ('utf-8' )
146+ self .assertIn ('is detached' , detach_data , '' )
146147 time .sleep (self .waittime )
147148 except Exception as e :
148149 self .fail ('Execution oci-network-config attach detach has failed: %s' % str (e ))
@@ -160,14 +161,17 @@ def test_add_remove_secondary_ip_0(self):
160161 self .assertIn ('Creating' , subprocess .check_output ([self .oci_net_config , 'attach-vnic' , '--name' , self .vnic_name ]).decode ('utf-8' ), 'attach vnic failed' )
161162 time .sleep (self .waittime )
162163 vn_ocid = self ._get_vnic_ocid (self .vnic_name )
163- response = subprocess .check_output ([self .oci_net_config , 'add-secondary-addr, --ocid' , vn_ocid ]).decode ('utf-8' ),
164- self .assertIn ('Provisioning secondary private IP ' , response , 'adding secondary ip failed' )
165- new_ip = _get_ip_from_response (response ) [0 ]
164+ response = subprocess .check_output ([self .oci_net_config , 'add-secondary-addr' , ' --ocid' , vn_ocid ]).decode ('utf-8' ). splitlines ()
165+ self .assertIn ('Provisioning secondary private' , response [ 0 ] , 'adding secondary ip failed' )
166+ new_ip = _get_ip_from_response (response [0 ])
166167 time .sleep (self .waittime )
167- self .assertIn ('Deconfigure secondary private IP' , subprocess .check_output ([self .oci_net_config , 'remove-secondary-addr' , '--ip-address' , new_ip ]).decode ('utf-8' ), 'remove secondary ip failed' )
168+ response = subprocess .check_output ([self .oci_net_config , 'remove-secondary-addr' , '--ip-address' , new_ip ]).decode ('utf-8' ).splitlines ()
169+ self .assertIn ('Deconfigure secondary private' , response [0 ], 'remove secondary ip failed' )
168170 time .sleep (self .waittime )
169- self .assertEqual (subprocess .check_output ([self .oci_net_config , 'detach-vnic' , '--ocid' , vn_ocid ]).decode ('utf-8' ), '' )
171+ detach_data = subprocess .check_output ([self .oci_net_config , 'detach-vnic' , '--ocid' , vn_ocid ]).decode ('utf-8' )
172+ self .assertIn ('is detached' , detach_data , '' )
170173 time .sleep (self .waittime )
174+
171175 except Exception as e :
172176 self .fail ('Execution oci-network-config attach detach has failed: %s' % str (e ))
173177
0 commit comments