def _remove(self): elems = self.info()['elements'] conns = self.info()['connections'] get_backend_core_proxy().topology_remove(self.topology_id) for e in elems: get_element_info(e).set_exists(False) for c in conns: get_connection_info(c).set_exists(False)
def _remove(self): elems = [get_element_info(e) for e in self.info()['elements']] conns = [get_connection_info(c) for c in self.info()['connections']] for e in elems: e.set_exists(None) for c in conns: c.set_exists(None) get_backend_core_proxy().topology_remove(self.topology_id)
def get_network_list(): """ get the list of networks :return: list of networks :rtype: list(dict) """ return get_backend_core_proxy().network_list()
def _template_id(tech, name): """ get template id by tech and name :param tech: template tech :param name: template name :return: template id """ return get_backend_core_proxy().template_id(tech, name)
def get_template_list(tech=None): """ get the list of all templates :param str tech: filter for tech if wanted :return: list of templates :rtype: list(dict) """ return get_backend_core_proxy().template_list(tech)
def get_site_list(organization=None): """ get the list of sites :param organization: if not None, filter by this organization. :return: list of sites, filtered if requested :rtype: list(dict) """ return get_backend_core_proxy().site_list(organization)
def get_profile_list(type=None): """ get the list of all profile :param str type: filter for type if wanted :return: list of profiles :rtype: list(dict) """ return get_backend_core_proxy().profile_list(type)
def get_profile_list(tech=None): """ get the list of all profile :param str tech: filter for tech if wanted :return: list of profiles :rtype: list(dict) """ return get_backend_core_proxy().profile_list(tech)
def _profile_id(tech, name): """ get profile id by tech and name :param tech: profile tech :param name: profile name :return: profile id """ return get_backend_core_proxy().profile_id(tech, name)
def _template_id(type, name): """ get template id by type and name :param type: template type :param name: template name :return: template id """ return get_backend_core_proxy().template_id(type, name)
def get_template_list(type=None): """ get the list of all templates :param str type: filter for type if wanted :return: list of templates :rtype: list(dict) """ return get_backend_core_proxy().template_list(type)
def _profile_id(type, name): """ get profile id by tech and name :param type: profile type :param name: profile name :return: profile id """ return get_backend_core_proxy().profile_id(type, name)
def _modify(self, attrs): orga = None if ('organization' in attrs) and (self.get_organization_name() != attrs['organization']): orga = self.get_organization_name() res = get_backend_core_proxy().site_modify(self.name, attrs) if orga is not None: get_organization_info(orga).invalidate_info() get_organization_info(attrs['organization']).invalidate_info() return res
def _modify(self, attrs): site = None if ('site' in attrs) and (self.get_site_name() != attrs['site']): site = self.get_site_name() res = get_backend_core_proxy().host_modify(self.name, attrs) if site is not None: get_site_info(site).invalidate_info() get_site_info(attrs['site']).invalidate_info() return res
def get_host_list(site=None, organization=None): """ get the list of hosts, filtered by site or organization, if requested. :param str site: site filter :param str organization: organization filter :return: list of hosts :rtype: list(dict) """ return get_backend_core_proxy().host_list(site, organization)
def get_network_instance_list(network=None, host=None): """ get the list of network instances :param network: filter by network :param host: filter by host :return: list of network instances :rtype: list(dict) """ return get_backend_core_proxy().network_instance_list(network, host)
def create(el1, el2, attrs): """ create connection :param ElementInfo el1: :param ElementInfo el2: :param dict attrs: connection attributes :return: """ return get_backend_core_proxy().connection_create(el1.get_id(), el2.get_id(), attrs)
def get_topology_list(full=False, organization_filter=None, username_filter=None): """ get the list of topologies :param bool full: expand children info :param str organization_filter: list of organizations :param str username_filter: username to filter for :return: list of topologies :rtype: list(dict) """ return get_backend_core_proxy().topology_list(full=full, organization_filter=organization_filter, username_filter=username_filter)
def set_permission(self, user, role): """ set the permission of a user :param str user: username of target user :param str role: role as in topology_role """ res = get_backend_core_proxy().topology_set_permission(self.topology_id, user, role) if self._info is not None: self._info['permissions'][user] = role return res
def create(top, type, parent_id, attrs): """ :param TopologyInfo top: target topology :param str type: element type :param str parent_id: id of parent element. None if no parent. :param attrs: element attrs :return: """ return get_backend_core_proxy().element_create(top.get_id(), type, parent_id, attrs)
def create(el1, el2, attrs): """ create connection :param ElementInfo el1: :param ElementInfo el2: :param dict attrs: connection attributes :return: """ conn = get_backend_core_proxy().connection_create(el1.get_id(), el2.get_id(), attrs) get_connection_info(conn['id']).invalidate_info() return conn
def _action(self, action, params): elems = self.info()['elements'] conns = self.info()['connections'] res = get_backend_core_proxy().topology_action(self.topology_id, action, params) for e in elems: get_element_info(e).invalidate_info() get_element_info(e).invalidate_exists() for c in conns: get_connection_info(c).invalidate_info() get_connection_info(c).invalidate_exists() return res
def create(el1, el2, attrs): """ create connection :param ElementInfo el1: :param ElementInfo el2: :param dict attrs: connection attributes :return: """ conn = get_backend_core_proxy().connection_create( el1.get_id(), el2.get_id(), attrs) get_connection_info(conn['id']).invalidate_info() return conn
def create(top, type, parent_id, attrs): """ :param TopologyInfo top: target topology :param str type: element type :param str parent_id: id of parent element. None if no parent. :param attrs: element attrs :return: """ element = get_backend_core_proxy().element_create(top.get_id(), type, parent_id, attrs) get_element_info(element['id']).invalidate_info() return element
def create(top, type, parent_id, attrs): """ :param TopologyInfo top: target topology :param str type: element type :param str parent_id: id of parent element. None if no parent. :param attrs: element attrs :return: """ element = get_backend_core_proxy().element_create( top.get_id(), type, parent_id, attrs) get_element_info(element['id']).invalidate_info() return element
def _modify(self, attrs): return get_backend_core_proxy().network_modify(self.kind, attrs)
def _fetch_info(self, fetch=False): return get_backend_core_proxy().network_info(self.kind)
def create(kind, attrs): res = get_backend_core_proxy().network_create(kind, attrs) get_network_list.invalidate() return res
def _fetch_info(self, fetch=False): return get_backend_core_proxy().network_instance_info(self.niid)
def _remove(self): get_backend_core_proxy().network_instance_remove(self.niid)
def _remove(self): get_backend_core_proxy().network_remove(self.kind)
def _modify(self, attrs): return get_backend_core_proxy().profile_modify(self.profile_id, attrs)
def _remove(self): get_backend_core_proxy().profile_remove(self.profile_id) _profile_id.invalidate()
def _modify(self, attrs): return get_backend_core_proxy().network_instance_modify(self.niid, attrs)
def create(network, host_name, attrs): res = get_backend_core_proxy().network_instance_create( network, host_name, attrs) get_network_instance_list.invalidate() return res
def _fetch_info(self, fetch=False): return get_backend_core_proxy().profile_info(self.profile_id)
def _modify(self, attrs): return get_backend_core_proxy().network_instance_modify( self.niid, attrs)
def create(network, host_name, attrs): res = get_backend_core_proxy().network_instance_create(network, host_name, attrs) get_network_instance_list.invalidate() return res