def get_parser(self, prog_name): parser = super(SetSubnet, self).get_parser(prog_name) parser.add_argument('subnet', metavar="<subnet>", help=_("Subnet to modify (name or ID)")) parser.add_argument('--name', metavar='<name>', help=_("Updated name of the subnet")) dhcp_enable_group = parser.add_mutually_exclusive_group() dhcp_enable_group.add_argument('--dhcp', action='store_true', default=None, help=_("Enable DHCP")) dhcp_enable_group.add_argument('--no-dhcp', action='store_true', help=_("Disable DHCP")) parser.add_argument( '--gateway', metavar='<gateway>', help=_("Specify a gateway for the subnet. The options are: " "<ip-address>: Specific IP address to use as the gateway, " "'none': This subnet will not use a gateway, " "e.g.: --gateway 192.168.9.1, --gateway none.")) parser.add_argument('--description', metavar='<description>', help=_("Set subnet description")) _tag.add_tag_option_to_parser_for_set(parser, _('subnet')) _get_common_parse_arguments(parser, is_create=False) return parser
def get_parser(self, prog_name): parser = super(SetFloatingIP, self).get_parser(prog_name) parser.add_argument('floating_ip', metavar='<floating-ip>', help=_("Floating IP to modify (IP address or ID)")) parser.add_argument( '--port', metavar='<port>', help=_("Associate the floating IP with port (name or ID)")), parser.add_argument('--fixed-ip-address', metavar='<ip-address>', dest='fixed_ip_address', help=_("Fixed IP of the port " "(required only if port has multiple IPs)")) qos_policy_group = parser.add_mutually_exclusive_group() qos_policy_group.add_argument( '--qos-policy', metavar='<qos-policy>', help=_("Attach QoS policy to the floating IP (name or ID)")) qos_policy_group.add_argument( '--no-qos-policy', action='store_true', help=_("Remove the QoS policy attached to the floating IP")) _tag.add_tag_option_to_parser_for_set(parser, _('floating IP')) return parser
def get_parser(self, prog_name): parser = super(SetSubnetPool, self).get_parser(prog_name) parser.add_argument('subnet_pool', metavar='<subnet-pool>', help=_("Subnet pool to modify (name or ID)")) parser.add_argument('--name', metavar='<name>', help=_("Set subnet pool name")) _add_prefix_options(parser) address_scope_group = parser.add_mutually_exclusive_group() address_scope_group.add_argument( '--address-scope', metavar='<address-scope>', help=_("Set address scope associated with the subnet pool " "(name or ID), prefixes must be unique across address " "scopes")) address_scope_group.add_argument( '--no-address-scope', action='store_true', help=_("Remove address scope associated with the subnet pool")) _add_default_options(parser) parser.add_argument('--description', metavar='<description>', help=_("Set subnet pool description")) parser.add_argument( '--default-quota', type=int, metavar='<num-ip-addresses>', help=_("Set default per-project quota for this subnet pool " "as the number of IP addresses that can be allocated " "from the subnet pool")), _tag.add_tag_option_to_parser_for_set(parser, _('subnet pool')) return parser
def get_parser(self, prog_name): parser = super(SetSubnet, self).get_parser(prog_name) parser.add_argument( 'subnet', metavar="<subnet>", help=_("Subnet to modify (name or ID)") ) parser.add_argument( '--name', metavar='<name>', help=_("Updated name of the subnet") ) dhcp_enable_group = parser.add_mutually_exclusive_group() dhcp_enable_group.add_argument( '--dhcp', action='store_true', default=None, help=_("Enable DHCP") ) dhcp_enable_group.add_argument( '--no-dhcp', action='store_true', help=_("Disable DHCP") ) parser.add_argument( '--gateway', metavar='<gateway>', help=_("Specify a gateway for the subnet. The options are: " "<ip-address>: Specific IP address to use as the gateway, " "'none': This subnet will not use a gateway, " "e.g.: --gateway 192.168.9.1, --gateway none.") ) parser.add_argument( '--network-segment', metavar='<network-segment>', help=_("Network segment to associate with this subnet (name or " "ID). It is only allowed to set the segment if the current " "value is `None`, the network must also have only one " "segment and only one subnet can exist on the network.") ) parser.add_argument( '--description', metavar='<description>', help=_("Set subnet description") ) _tag.add_tag_option_to_parser_for_set(parser, _('subnet')) _get_common_parse_arguments(parser, is_create=False) return parser
def get_parser(self, prog_name): parser = super(SetNetwork, self).get_parser(prog_name) parser.add_argument('network', metavar="<network>", help=_("Network to modify (name or ID)")) parser.add_argument('--name', metavar='<name>', help=_("Set network name")) admin_group = parser.add_mutually_exclusive_group() admin_group.add_argument('--enable', action='store_true', default=None, help=_("Enable network")) admin_group.add_argument('--disable', action='store_true', help=_("Disable network")) share_group = parser.add_mutually_exclusive_group() share_group.add_argument('--share', action='store_true', default=None, help=_("Share the network between projects")) share_group.add_argument( '--no-share', action='store_true', help=_("Do not share the network between projects")) parser.add_argument('--description', metavar="<description", help=_("Set network description")) port_security_group = parser.add_mutually_exclusive_group() port_security_group.add_argument( '--enable-port-security', action='store_true', help=_("Enable port security by default for ports created on " "this network")) port_security_group.add_argument( '--disable-port-security', action='store_true', help=_("Disable port security by default for ports created on " "this network")) external_router_grp = parser.add_mutually_exclusive_group() external_router_grp.add_argument( '--external', action='store_true', help=_("Set this network as an external network " "(external-net extension required)")) external_router_grp.add_argument( '--internal', action='store_true', help=_("Set this network as an internal network")) default_router_grp = parser.add_mutually_exclusive_group() default_router_grp.add_argument( '--default', action='store_true', help=_("Set the network as the default external network")) default_router_grp.add_argument( '--no-default', action='store_true', help=_("Do not use the network as the default external network")) qos_group = parser.add_mutually_exclusive_group() qos_group.add_argument( '--qos-policy', metavar='<qos-policy>', help=_("QoS policy to attach to this network (name or ID)")) qos_group.add_argument( '--no-qos-policy', action='store_true', help=_("Remove the QoS policy attached to this network")) _tag.add_tag_option_to_parser_for_set(parser, _('network')) _add_additional_network_options(parser) return parser
def get_parser(self, prog_name): parser = super(SetPort, self).get_parser(prog_name) _add_updatable_args(parser) admin_group = parser.add_mutually_exclusive_group() admin_group.add_argument('--enable', action='store_true', default=None, help=_("Enable port")) admin_group.add_argument('--disable', action='store_true', help=_("Disable port")) parser.add_argument('--name', metavar="<name>", help=_("Set port name")) parser.add_argument( '--fixed-ip', metavar='subnet=<subnet>,ip-address=<ip-address>', action=parseractions.MultiKeyValueAction, optional_keys=['subnet', 'ip-address'], help=_("Desired IP and/or subnet for this port (name or ID): " "subnet=<subnet>,ip-address=<ip-address> " "(repeat option to set multiple fixed IP addresses)")) parser.add_argument( '--no-fixed-ip', action='store_true', help=_("Clear existing information of fixed IP addresses." "Specify both --fixed-ip and --no-fixed-ip " "to overwrite the current fixed IP addresses.")) parser.add_argument( '--binding-profile', metavar='<binding-profile>', action=JSONKeyValueAction, help=_("Custom data to be passed as binding:profile. Data may " "be passed as <key>=<value> or JSON. " "(repeat option to set multiple binding:profile data)")) parser.add_argument( '--no-binding-profile', action='store_true', help=_("Clear existing information of binding:profile." "Specify both --binding-profile and --no-binding-profile " "to overwrite the current binding:profile information.")) parser.add_argument( '--qos-policy', metavar='<qos-policy>', help=_("Attach QoS policy to this port (name or ID)")) parser.add_argument('port', metavar="<port>", help=_("Port to modify (name or ID)")) parser.add_argument( '--security-group', metavar='<security-group>', action='append', dest='security_group', help=_("Security group to associate with this port (name or ID) " "(repeat option to set multiple security groups)")) parser.add_argument( '--no-security-group', dest='no_security_group', action='store_true', help=_("Clear existing security groups associated with this port")) port_security = parser.add_mutually_exclusive_group() port_security.add_argument( '--enable-port-security', action='store_true', help=_("Enable port security for this port")) port_security.add_argument( '--disable-port-security', action='store_true', help=_("Disable port security for this port")) parser.add_argument( '--allowed-address', metavar='ip-address=<ip-address>[,mac-address=<mac-address>]', action=parseractions.MultiKeyValueAction, dest='allowed_address_pairs', required_keys=['ip-address'], optional_keys=['mac-address'], help=_("Add allowed-address pair associated with this port: " "ip-address=<ip-address>[,mac-address=<mac-address>] " "(repeat option to set multiple allowed-address pairs)")) parser.add_argument( '--no-allowed-address', dest='no_allowed_address_pair', action='store_true', help=_("Clear existing allowed-address pairs associated" "with this port." "(Specify both --allowed-address and --no-allowed-address" "to overwrite the current allowed-address pairs)")) parser.add_argument( '--data-plane-status', metavar='<status>', choices=['ACTIVE', 'DOWN'], help=_("Set data plane status of this port (ACTIVE | DOWN). " "Unset it to None with the 'port unset' command " "(requires data plane status extension)")) _tag.add_tag_option_to_parser_for_set(parser, _('port')) return parser
def update_parser_network(self, parser): _tag.add_tag_option_to_parser_for_set(parser, _('security group')) return parser
def get_parser(self, prog_name): parser = super(SetRouter, self).get_parser(prog_name) parser.add_argument( 'router', metavar="<router>", help=_("Router to modify (name or ID)") ) parser.add_argument( '--name', metavar='<name>', help=_("Set router name") ) parser.add_argument( '--description', metavar='<description>', help=_('Set router description') ) admin_group = parser.add_mutually_exclusive_group() admin_group.add_argument( '--enable', action='store_true', default=None, help=_("Enable router") ) admin_group.add_argument( '--disable', action='store_true', help=_("Disable router") ) distribute_group = parser.add_mutually_exclusive_group() distribute_group.add_argument( '--distributed', action='store_true', help=_("Set router to distributed mode (disabled router only)") ) distribute_group.add_argument( '--centralized', action='store_true', help=_("Set router to centralized mode (disabled router only)") ) routes_group = parser.add_mutually_exclusive_group() # ToDo(Reedip):Remove mutual exclusiveness once clear-routes is removed parser.add_argument( '--route', metavar='destination=<subnet>,gateway=<ip-address>', action=parseractions.MultiKeyValueAction, dest='routes', default=None, required_keys=['destination', 'gateway'], help=_("Routes associated with the router " "destination: destination subnet (in CIDR notation) " "gateway: nexthop IP address " "(repeat option to set multiple routes)") ) routes_group.add_argument( '--no-route', action='store_true', help=_("Clear routes associated with the router. " "Specify both --route and --no-route to overwrite " "current value of route.") ) routes_group.add_argument( '--clear-routes', action='store_true', help=argparse.SUPPRESS, ) routes_ha = parser.add_mutually_exclusive_group() routes_ha.add_argument( '--ha', action='store_true', help=_("Set the router as highly available " "(disabled router only)") ) routes_ha.add_argument( '--no-ha', action='store_true', help=_("Clear high availability attribute of the router " "(disabled router only)") ) parser.add_argument( '--external-gateway', metavar="<network>", help=_("External Network used as router's gateway (name or ID)") ) parser.add_argument( '--fixed-ip', metavar='subnet=<subnet>,ip-address=<ip-address>', action=parseractions.MultiKeyValueAction, optional_keys=['subnet', 'ip-address'], help=_("Desired IP and/or subnet (name or ID)" "on external gateway: " "subnet=<subnet>,ip-address=<ip-address> " "(repeat option to set multiple fixed IP addresses)") ) snat_group = parser.add_mutually_exclusive_group() snat_group.add_argument( '--enable-snat', action='store_true', help=_("Enable Source NAT on external gateway") ) snat_group.add_argument( '--disable-snat', action='store_true', help=_("Disable Source NAT on external gateway") ) _tag.add_tag_option_to_parser_for_set(parser, _('router')) return parser
def get_parser(self, prog_name): parser = super(SetPort, self).get_parser(prog_name) _add_updatable_args(parser) admin_group = parser.add_mutually_exclusive_group() admin_group.add_argument( '--enable', action='store_true', default=None, help=_("Enable port") ) admin_group.add_argument( '--disable', action='store_true', help=_("Disable port") ) parser.add_argument( '--name', metavar="<name>", help=_("Set port name") ) parser.add_argument( '--fixed-ip', metavar='subnet=<subnet>,ip-address=<ip-address>', action=parseractions.MultiKeyValueAction, optional_keys=['subnet', 'ip-address'], help=_("Desired IP and/or subnet for this port (name or ID): " "subnet=<subnet>,ip-address=<ip-address> " "(repeat option to set multiple fixed IP addresses)") ) parser.add_argument( '--no-fixed-ip', action='store_true', help=_("Clear existing information of fixed IP addresses." "Specify both --fixed-ip and --no-fixed-ip " "to overwrite the current fixed IP addresses.") ) parser.add_argument( '--binding-profile', metavar='<binding-profile>', action=JSONKeyValueAction, help=_("Custom data to be passed as binding:profile. Data may " "be passed as <key>=<value> or JSON. " "(repeat option to set multiple binding:profile data)") ) parser.add_argument( '--no-binding-profile', action='store_true', help=_("Clear existing information of binding:profile. " "Specify both --binding-profile and --no-binding-profile " "to overwrite the current binding:profile information.") ) parser.add_argument( '--qos-policy', metavar='<qos-policy>', help=_("Attach QoS policy to this port (name or ID)") ) parser.add_argument( 'port', metavar="<port>", help=_("Port to modify (name or ID)") ) parser.add_argument( '--security-group', metavar='<security-group>', action='append', dest='security_group', help=_("Security group to associate with this port (name or ID) " "(repeat option to set multiple security groups)") ) parser.add_argument( '--no-security-group', dest='no_security_group', action='store_true', help=_("Clear existing security groups associated with this port") ) port_security = parser.add_mutually_exclusive_group() port_security.add_argument( '--enable-port-security', action='store_true', help=_("Enable port security for this port") ) port_security.add_argument( '--disable-port-security', action='store_true', help=_("Disable port security for this port") ) parser.add_argument( '--allowed-address', metavar='ip-address=<ip-address>[,mac-address=<mac-address>]', action=parseractions.MultiKeyValueAction, dest='allowed_address_pairs', required_keys=['ip-address'], optional_keys=['mac-address'], help=_("Add allowed-address pair associated with this port: " "ip-address=<ip-address>[,mac-address=<mac-address>] " "(repeat option to set multiple allowed-address pairs)") ) parser.add_argument( '--no-allowed-address', dest='no_allowed_address_pair', action='store_true', help=_("Clear existing allowed-address pairs associated " "with this port. " "(Specify both --allowed-address and --no-allowed-address " "to overwrite the current allowed-address pairs)") ) parser.add_argument( '--data-plane-status', metavar='<status>', choices=['ACTIVE', 'DOWN'], help=_("Set data plane status of this port (ACTIVE | DOWN). " "Unset it to None with the 'port unset' command " "(requires data plane status extension)") ) _tag.add_tag_option_to_parser_for_set(parser, _('port')) return parser
def get_parser(self, prog_name): parser = super(SetRouter, self).get_parser(prog_name) parser.add_argument( 'router', metavar="<router>", help=_("Router to modify (name or ID)") ) parser.add_argument( '--name', metavar='<name>', help=_("Set router name") ) parser.add_argument( '--description', metavar='<description>', help=_('Set router description') ) admin_group = parser.add_mutually_exclusive_group() admin_group.add_argument( '--enable', action='store_true', default=None, help=_("Enable router") ) admin_group.add_argument( '--disable', action='store_true', help=_("Disable router") ) distribute_group = parser.add_mutually_exclusive_group() distribute_group.add_argument( '--distributed', action='store_true', help=_("Set router to distributed mode (disabled router only)") ) distribute_group.add_argument( '--centralized', action='store_true', help=_("Set router to centralized mode (disabled router only)") ) routes_group = parser.add_mutually_exclusive_group() # ToDo(Reedip):Remove mutual exclusiveness once clear-routes is removed parser.add_argument( '--route', metavar='destination=<subnet>,gateway=<ip-address>', action=parseractions.MultiKeyValueAction, dest='routes', default=None, required_keys=['destination', 'gateway'], help=_("Routes associated with the router " "destination: destination subnet (in CIDR notation) " "gateway: nexthop IP address " "(repeat option to set multiple routes)") ) routes_group.add_argument( '--no-route', action='store_true', help=_("Clear routes associated with the router. " "Specify both --route and --no-route to overwrite " "current value of route.") ) routes_group.add_argument( '--clear-routes', action='store_true', help=argparse.SUPPRESS, ) routes_ha = parser.add_mutually_exclusive_group() routes_ha.add_argument( '--ha', action='store_true', help=_("Set the router as highly available " "(disabled router only)") ) routes_ha.add_argument( '--no-ha', action='store_true', help=_("Clear high availability attribute of the router " "(disabled router only)") ) parser.add_argument( '--external-gateway', metavar="<network>", help=_("External Network used as router's gateway (name or ID)") ) parser.add_argument( '--fixed-ip', metavar='subnet=<subnet>,ip-address=<ip-address>', action=parseractions.MultiKeyValueAction, optional_keys=['subnet', 'ip-address'], help=_("Desired IP and/or subnet (name or ID) " "on external gateway: " "subnet=<subnet>,ip-address=<ip-address> " "(repeat option to set multiple fixed IP addresses)") ) snat_group = parser.add_mutually_exclusive_group() snat_group.add_argument( '--enable-snat', action='store_true', help=_("Enable Source NAT on external gateway") ) snat_group.add_argument( '--disable-snat', action='store_true', help=_("Disable Source NAT on external gateway") ) qos_policy_group = parser.add_mutually_exclusive_group() qos_policy_group.add_argument( '--qos-policy', metavar='<qos-policy>', help=_("Attach QoS policy to router gateway IPs") ) qos_policy_group.add_argument( '--no-qos-policy', action='store_true', help=_("Remove QoS policy from router gateway IPs") ) _tag.add_tag_option_to_parser_for_set(parser, _('router')) return parser
def update_parser_network(self, parser): _tag.add_tag_option_to_parser_for_set( parser, _('security group'), enhance_help=self.enhance_help_neutron) return parser