def delete(**kwargs): use_existing, router_dict = common.get_properties('router', kwargs) if use_existing: nsx_dlr.remove_properties_edges() ctx.logger.info("Used pre existed!") return resource_id = ctx.instance.runtime_properties.get('resource_id') if not resource_id: nsx_dlr.remove_properties_edges() ctx.logger.info("We dont have resource_id") return # credentials client_session = common.nsx_login(kwargs) common.attempt_with_rerun( nsx_dlr.del_edge, client_session=client_session, resource_id=resource_id ) ctx.logger.info("deleted %s" % resource_id) nsx_dlr.remove_properties_edges()
def delete(**kwargs): use_existing, interface = common.get_properties('interface', kwargs) if use_existing: common.remove_properties('interface') common.remove_properties('ifindex') ctx.logger.info("Used existed") return resource_id = ctx.instance.runtime_properties.get('resource_id') if not resource_id: common.remove_properties('interface') common.remove_properties('ifindex') ctx.logger.info("Not fully created, skip") return # credentials client_session = common.nsx_login(kwargs) common.attempt_with_rerun(nsx_esg.esg_clear_interface, client_session=client_session, resource_id=resource_id) ctx.logger.info("delete %s" % resource_id) common.remove_properties('interface') common.remove_properties('ifindex')
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 test_get_properties_public(self): """Check nsx_common.get_properties func""" self._regen_ctx() self.assertEqual( common.get_properties('some_name', {'some_name': { 'somevalue': True }}), (False, {'somevalue': True}) )
def test_get_properties_public_external_inputs(self): """Check nsx_common.get_properties func: use_external_resource in inputs""" self._regen_ctx() self.assertEqual( common.get_properties('some_name', {'some_name': { 'somevalue': False }, 'use_external_resource': True}), (True, {'somevalue': False}) )
def test_get_properties_public_external_properties(self): """Check nsx_common.get_properties func: use_external_resource in properties""" self._regen_ctx() self.fake_ctx.node.properties['use_external_resource'] = True self.assertEqual( common.get_properties('some_name', {'some_name': { 'somevalue': False }}), (True, {'somevalue': False}) )
def test_get_properties_public_external_inputs_presaved(self): """Check nsx_common.get_properties func: use_external_resource in inputs, prestored""" self._regen_ctx() # case when in install we already set use_external_resource # to input runtime_properties = self.fake_ctx.instance.runtime_properties runtime_properties['use_external_resource'] = True self.assertEqual( common.get_properties('some_name', {'some_name': { 'somevalue': False }}), (True, {'somevalue': False}) )
def delete(**kwargs): use_existing, area = common.get_properties('prefix', kwargs) if use_existing: common.remove_properties('prefix') ctx.logger.info("Used existed") return resource_id = ctx.instance.runtime_properties.get('resource_id') if not resource_id: common.remove_properties('prefix') ctx.logger.info("Not fully created, skip") return # credentials client_session = common.nsx_login(kwargs) common.attempt_with_rerun(cfy_dlr.del_routing_prefix, client_session=client_session, resource_id=resource_id) ctx.logger.info("deleted %s" % resource_id) common.remove_properties('prefix')