本文整理汇总了Python中neutronclient.neutron.v2_0.update_dict函数的典型用法代码示例。如果您正苦于以下问题:Python update_dict函数的具体用法?Python update_dict怎么用?Python update_dict使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了update_dict函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: args2body
def args2body(self, parsed_args):
_policy_id = neutronv20.find_resourceid_by_name_or_id(
self.get_client(), "firewall_policy", parsed_args.firewall_policy_id
)
body = {self.resource: {"firewall_policy_id": _policy_id, "admin_state_up": parsed_args.admin_state}}
neutronv20.update_dict(parsed_args, body[self.resource], ["name", "description", "shared", "tenant_id"])
return body
示例2: args2body
def args2body(self, parsed_args):
body = {}
if hasattr(parsed_args, 'admin_state'):
body['admin_state_up'] = parsed_args.admin_state
neutronV20.update_dict(parsed_args, body,
['name', 'distributed'])
return {self.resource: body}
示例3: args2body
def args2body(self, parsed_args):
_subnet_id = neutronV20.find_resourceid_by_name_or_id(self.get_client(), "subnet", parsed_args.subnet_id)
body = {"admin_state_up": parsed_args.admin_state, "subnet_id": _subnet_id}
neutronV20.update_dict(
parsed_args, body, ["description", "lb_method", "name", "protocol", "tenant_id", "provider"]
)
return {self.resource: body}
示例4: args2body
def args2body(self, parsed_args):
body = {}
validate_peer_attributes(parsed_args)
neutronv20.update_dict(parsed_args, body,
['name', 'peer_ip',
'remote_as', 'auth_type', 'password'])
return {self.resource: body}
示例5: args2body
def args2body(self, parsed_args):
body = {
self.resource: {}
}
neutronV20.update_dict(parsed_args, body[self.resource],
['name','description','certificate_content','private_key'])
return body
示例6: args2body
def args2body(self, parsed_args):
if parsed_args.loadbalancer:
parsed_args.loadbalancer = _get_loadbalancer_id(self.get_client(), parsed_args.loadbalancer)
body = {
self.resource: {
"loadbalancer_id": parsed_args.loadbalancer,
"protocol": parsed_args.protocol,
"protocol_port": parsed_args.protocol_port,
"admin_state_up": parsed_args.admin_state,
}
}
neutronV20.update_dict(
parsed_args,
body[self.resource],
[
"connection-limit",
"description",
"loadbalancer_id",
"name",
"default_tls_container_id",
"sni_container_ids",
"tenant_id",
],
)
return body
示例7: args2body
def args2body(self, parsed_args):
body = {'admin_state_up': parsed_args.admin_state}
neutronV20.update_dict(parsed_args, body,
['name', 'tenant_id', 'distributed', 'ha',
'description'])
availability_zone.args2body_az_hint(parsed_args, body)
return {self.resource: body}
示例8: updatable_args2body
def updatable_args2body(parsed_args, body, for_create=True, ip_version=None):
if parsed_args.disable_dhcp and parsed_args.enable_dhcp:
raise exceptions.CommandError(_(
"You cannot enable and disable DHCP at the same time."))
neutronV20.update_dict(parsed_args, body,
['name', 'allocation_pools',
'host_routes', 'dns_nameservers',
'description'])
if parsed_args.no_gateway:
body['gateway_ip'] = None
elif parsed_args.gateway:
body['gateway_ip'] = parsed_args.gateway
if parsed_args.disable_dhcp:
body['enable_dhcp'] = False
if parsed_args.enable_dhcp:
body['enable_dhcp'] = True
if for_create and parsed_args.ipv6_ra_mode:
if ip_version == 4:
raise exceptions.CommandError(_("--ipv6-ra-mode is invalid "
"when --ip-version is 4"))
body['ipv6_ra_mode'] = parsed_args.ipv6_ra_mode
if for_create and parsed_args.ipv6_address_mode:
if ip_version == 4:
raise exceptions.CommandError(_("--ipv6-address-mode is "
"invalid when --ip-version "
"is 4"))
body['ipv6_address_mode'] = parsed_args.ipv6_address_mode
示例9: args2body
def args2body(self, parsed_args):
body = {'network': {
'name': parsed_args.name,
'admin_state_up': parsed_args.admin_state}, }
neutronV20.update_dict(parsed_args, body['network'],
['shared', 'tenant_id'])
return body
示例10: args2body
def args2body(self, parsed_args):
body = {
self.resource: {
'admin_state_up': parsed_args.admin_state, }, }
neutronV20.update_dict(parsed_args, body[self.resource],
['description'])
return body
示例11: _common_args2body
def _common_args2body(client, parsed_args, is_create=True):
if parsed_args.redirect_url:
if parsed_args.action != 'REDIRECT_TO_URL':
raise exceptions.CommandError(_('Action must be REDIRECT_TO_URL'))
if parsed_args.redirect_pool:
if parsed_args.action != 'REDIRECT_TO_POOL':
raise exceptions.CommandError(_('Action must be REDIRECT_TO_POOL'))
parsed_args.redirect_pool_id = _get_pool_id(
client, parsed_args.redirect_pool)
if (parsed_args.action == 'REDIRECT_TO_URL' and
not parsed_args.redirect_url):
raise exceptions.CommandError(_('Redirect URL must be specified'))
if (parsed_args.action == 'REDIRECT_TO_POOL' and
not parsed_args.redirect_pool):
raise exceptions.CommandError(_('Redirect pool must be specified'))
attributes = ['name', 'description',
'action', 'redirect_pool_id', 'redirect_url',
'position', 'admin_state_up']
if is_create:
parsed_args.listener_id = _get_listener_id(
client, parsed_args.listener)
attributes.extend(['listener_id', 'tenant_id'])
body = {}
neutronV20.update_dict(parsed_args, body, attributes)
return {'l7policy': body}
示例12: args2body
def args2body(self, parsed_args):
body = {'name': parsed_args.name}
neutronV20.update_dict(parsed_args, body,
['segment_type', 'sub_type', 'segment_range',
'physical_network', 'multicast_ip_range',
'add_tenants'])
return {'network_profile': body}
示例13: args2body
def args2body(self, parsed_args, body=None):
"""Add in conditional args and then return all conn info."""
if body is None:
body = {}
if parsed_args.dpd:
vpn_utils.validate_dpd_dict(parsed_args.dpd)
body['dpd'] = parsed_args.dpd
if parsed_args.local_ep_group:
_local_epg = neutronv20.find_resourceid_by_name_or_id(
self.get_client(), 'endpoint_group',
parsed_args.local_ep_group)
body['local_ep_group_id'] = _local_epg
if parsed_args.peer_ep_group:
_peer_epg = neutronv20.find_resourceid_by_name_or_id(
self.get_client(), 'endpoint_group',
parsed_args.peer_ep_group)
body['peer_ep_group_id'] = _peer_epg
if hasattr(parsed_args, 'mtu') and int(parsed_args.mtu) < 68:
message = _("Invalid MTU value: MTU must be "
"greater than or equal to 68.")
raise exceptions.CommandError(message)
# ToDo (Reedip) : Remove below check when peer-cidr is removed
if parsed_args.peer_cidrs and parsed_args.local_ep_group:
message = _("You cannot specify both endpoint groups and peer "
"CIDR(s).")
raise exceptions.CommandError(message)
neutronv20.update_dict(parsed_args, body,
['peer_id', 'mtu', 'initiator', 'psk',
'peer_address', 'name', 'description',
'peer_cidrs'])
return {self.resource: body}
示例14: comman_args2body
def comman_args2body(parsed_args):
body = {'ovsvapp_cluster': {
'vcenter_id': parsed_args.vcenter_id,
'clusters': parsed_args.clusters}, }
neutronV20.update_dict(parsed_args, body['ovsvapp_cluster'],
['vcenter_id', 'clusters'])
return body
示例15: args2body
def args2body(self, parsed_args):
body = {
self.resource: {}
}
neutronV20.update_dict(parsed_args, body[self.resource],
['key','value'])
return body