def test_remove_properties(self): """Check nsx_common.remove_properties func""" self._regen_ctx() runtime_properties = self.fake_ctx.instance.runtime_properties runtime_properties['resource_id'] = '1' runtime_properties['resource'] = '2' runtime_properties['not_resource'] = '3' runtime_properties['nsx_auth'] = '4' runtime_properties['use_external_resource'] = '5' common.remove_properties('resource') self.assertEqual( self.fake_ctx.instance.runtime_properties, {'not_resource': '3'} )
def delete(**kwargs): use_existing, interface = common.get_properties('interface', kwargs) if use_existing: common.remove_properties('interface') ctx.logger.info("Used existed") return resource_id = ctx.instance.runtime_properties.get('resource_id') if not resource_id: common.remove_properties('interface') ctx.logger.info("Not fully created, skip") return # credentials client_session = common.nsx_login(kwargs) common.attempt_with_rerun( cfy_dlr.del_esg_ospf_interface, client_session=client_session, resource_id=resource_id ) ctx.logger.info("deleted %s" % resource_id) common.remove_properties('interface')
def delete(**kwargs): use_existing, dynamic_member = common.get_properties( 'dynamic_member', kwargs) if use_existing: common.remove_properties('dynamic_member') ctx.logger.info("Used existed") return resource_id = ctx.instance.runtime_properties.get('resource_id') if not resource_id: common.remove_properties('dynamic_member') ctx.logger.info("Not fully created, skip") return # credentials client_session = common.nsx_login(kwargs) common.attempt_with_rerun(nsx_security_group.del_dynamic_member, client_session=client_session, security_group_id=resource_id) ctx.logger.info("delete %s" % resource_id) common.remove_properties('dynamic_member')
def delete(**kwargs): use_existing, route = common.get_properties('route', kwargs) if use_existing: common.remove_properties('route') ctx.logger.info("Used existed") return resource_id = ctx.instance.runtime_properties.get('resource_id') if not resource_id: common.remove_properties('route') ctx.logger.info("Not fully created, skip") return client_session = common.nsx_login(kwargs) common.attempt_with_rerun(nsx_esg.esg_route_del, client_session=client_session, resource_id=resource_id) ctx.logger.info("delete %s" % resource_id) common.remove_properties('route')
def delete(**kwargs): use_existing, bind_dict = common.get_properties('bind', kwargs) if use_existing: common.remove_properties('bind') ctx.logger.info("Used pre existed!") return resource_id = ctx.instance.runtime_properties.get('resource_id') if not resource_id: common.remove_properties('bind') ctx.logger.info("We dont have resource_id") return # credentials client_session = common.nsx_login(kwargs) common.attempt_with_rerun(nsx_dhcp.delete_dhcp_binding, client_session=client_session, resource_id=resource_id) ctx.logger.info("deleted %s" % resource_id) common.remove_properties('bind')
def delete(**kwargs): common.remove_properties('nsx_object')