本文整理匯總了Python中vnc_api.vnc_api.VncApi.fabric_namespace_delete方法的典型用法代碼示例。如果您正苦於以下問題:Python VncApi.fabric_namespace_delete方法的具體用法?Python VncApi.fabric_namespace_delete怎麽用?Python VncApi.fabric_namespace_delete使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類vnc_api.vnc_api.VncApi
的用法示例。
在下文中一共展示了VncApi.fabric_namespace_delete方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: SanityBase
# 需要導入模塊: from vnc_api.vnc_api import VncApi [as 別名]
# 或者: from vnc_api.vnc_api.VncApi import fabric_namespace_delete [as 別名]
#.........這裏部分代碼省略.........
parent_type='global-system-config',
device_image_file_uri=img_uri,
device_image_os_version=img_version,
device_image_device_family=img_family,
device_image_vendor_name=img_vendor
)
img_uuid = self._api.device_image_create(image)
image = self._api.device_image_read(id=img_uuid)
except RefsExistError:
self._logger.warn("Image '%s' already exists", img_name)
image = self._api.device_image_read(fq_name=img_fqname)
self._logger.debug(
"Image created:\n%s",
pprint.pformat(self._api.obj_to_dict(image), indent=4))
return image
# end create_image_and_device
def cleanup_fabric(self, fab_name):
"""delete fabric including all prouters in the fabric"""
try:
self._logger.info('Deleting fabric "%s" ...', fab_name)
fab_fqname = ['default-global-system-config', fab_name]
fab = self._api.fabric_read(fq_name=fab_fqname)
# delete all namespaces in this fabric
fab_namespaces = self._api.fabric_namespaces_list(
parent_id=fab.uuid)
for namespace in fab_namespaces.get('fabric-namespaces') or []:
self._logger.debug(
"Delete namespace: %s", namespace.get('fq_name'))
self._api.fabric_namespace_delete(namespace.get('fq_name'))
# delete fabric
self._logger.debug("Delete fabric: %s", fab_fqname)
self._api.fabric_delete(fab_fqname)
# delete all prouters in this fabric
for prouter in fab.get_physical_router_back_refs() or []:
self._delete_prouter(prouter.get('uuid'))
except NoIdError:
self._logger.warn('Fabric "%s" not found', fab_name)
# end cleanup_fabric
def cleanup_image(self, img_name,):
# image cleanup
self._logger.info("Clean up image and prouter from db")
try:
img_fqname = ['default-global-system-config', img_name]
img = self._api.device_image_read(fq_name=img_fqname)
self._logger.debug(
"Delete Image: %s", img_fqname)
self._api.device_image_delete(img_fqname)
except NoIdError:
self._logger.warn('Image "%s" not found', img_name)
def _delete_prouter(self, uuid):
prouter = self._api.physical_router_read(id=uuid)
# delete all physical and logical interfaces
ifds = self._api.physical_interfaces_list(parent_id=uuid)
for ifd in ifds.get('physical-interfaces') or []:
示例2: import
# 需要導入模塊: from vnc_api.vnc_api import VncApi [as 別名]
# 或者: from vnc_api.vnc_api.VncApi import fabric_namespace_delete [as 別名]
from vnc_api.vnc_api import VncApi
from vnc_api.gen.resource_client import (
Fabric,
FabricNamespace,
VirtualNetwork,
NetworkIpam
)
vnc_api = VncApi()
#import pdb; pdb.set_trace()
namespaces = vnc_api.fabric_namespaces_list(detail=True)
for ns in namespaces:
vnc_api.fabric_namespace_delete(id=ns.uuid)
fabs = vnc_api.fabrics_list(detail=True)
for fab in fabs:
# remove fabric->vn refs
fab.set_virtual_network_list([])
vnc_api.fabric_update(fab)
# remove fabric->node_profile refs
fab.set_node_profile_list([])
vnc_api.fabric_update(fab)
# remove fabric
vnc_api.fabric_delete(id=fab.uuid)
role_configs = vnc_api.role_configs_list(detail=True)
for role_config in role_configs: