def create_router(self, name, **kwargs): uri = '%s/routers' % (self.uri_prefix) router = common.Element("router") router.append(common.Element("name", name)) common.deep_dict_to_xml(router, kwargs) resp, body = self.post(uri, str(common.Document(router))) body = _root_tag_fetcher_and_xml_to_json_parse(body) return resp, body
def create_ipsecpolicy(self, name, **kwargs): uri = '%s/vpn/ipsecpolicies' % (self.uri_prefix) ipsecpolicy = common.Element("ipsecpolicy") p1 = common.Element("name", name) ipsecpolicy.append(p1) common.deep_dict_to_xml(ipsecpolicy, kwargs) resp, body = self.post(uri, str(common.Document(ipsecpolicy))) body = _root_tag_fetcher_and_xml_to_json_parse(body) return resp, body
def create_vpnservice(self, subnet_id, router_id, **kwargs): uri = '%s/vpn/vpnservices' % (self.uri_prefix) vpnservice = common.Element("vpnservice") p1 = common.Element("subnet_id", subnet_id) p2 = common.Element("router_id", router_id) vpnservice.append(p1) vpnservice.append(p2) common.deep_dict_to_xml(vpnservice, kwargs) resp, body = self.post(uri, str(common.Document(vpnservice))) body = _root_tag_fetcher_and_xml_to_json_parse(body) return resp, body
def update_quota_set(self, tenant_id, gigabytes=None, volumes=None, snapshots=None): post_body = {} element = xml.Element("quota_set") if gigabytes is not None: post_body['gigabytes'] = gigabytes if volumes is not None: post_body['volumes'] = volumes if snapshots is not None: post_body['snapshots'] = snapshots xml.deep_dict_to_xml(element, post_body) resp, body = self.put('os-quota-sets/%s' % tenant_id, str(xml.Document(element))) body = xml.xml_to_json(etree.fromstring(body)) return resp, self._format_quota(body)