diff --git a/cli-client/pvc.py b/cli-client/pvc.py index 1cba0019..922f46ab 100755 --- a/cli-client/pvc.py +++ b/cli-client/pvc.py @@ -638,6 +638,11 @@ def net_add(vni, description, domain, ip_network, ip_gateway, dhcp_flag, dhcp_st default=None, help='Description of the network; should not contain whitespace.' ) +@click.option( + '-n', '--domain', 'domain', + default=None, + help='Domain name of the network.' +) @click.option( '-i', '--ipnet', 'ip_network', default=None, @@ -648,30 +653,35 @@ def net_add(vni, description, domain, ip_network, ip_gateway, dhcp_flag, dhcp_st default=None, help='Default gateway address for subnet.' ) -@click.option( - '-r', '--router', 'ip_routers', - multiple=True, - help='Router addresses for subnet (specify one or two; mapped to routers in order given).' -) @click.option( '--dhcp/--no-dhcp', 'dhcp_flag', default=None, is_flag=True, help='Enable/disable DHCP for clients on subnet.' ) +@click.option( + '--dhcp-start', 'dhcp_start', + default=None, + help='DHCP range start address.' +) +@click.option( + '--dhcp-end', 'dhcp_end', + default=None, + help='DHCP range end address.' +) @click.argument( 'vni' ) -def net_modify(vni, description, ip_network, ip_gateway, ip_routers, dhcp_flag): +def net_modify(vni, description, domain, ip_network, ip_gateway, dhcp_flag, dhcp_start, dhcp_end): """ Modify details of virtual network VNI. All fields optional; only specified fields will be updated. Example: - pvc network modify 1001 --gateway 10.1.1.255 --router 10.1.1.251 --router 10.1.1.252 --no-dhcp + pvc network modify 1001 --gateway 10.1.1.1 --dhcp """ zk_conn = pvc_common.startZKConnection(zk_host) - retcode, retmsg = pvc_network.modify_network(zk_conn, vni, description=description, ip_network=ip_network, ip_gateway=ip_gateway, ip_routers=ip_routers, dhcp_flag=dhcp_flag) + retcode, retmsg = pvc_network.modify_network(zk_conn, vni, description=description, domain=domain, ip_network=ip_network, ip_gateway=ip_gateway, dhcp_flag=dhcp_flag, dhcp_start=dhcp_start, dhcp_end=dhcp_end) cleanup(retcode, retmsg, zk_conn) ############################################################################### diff --git a/client-common/client_lib/network.py b/client-common/client_lib/network.py index 5f8aecf5..8858904c 100644 --- a/client-common/client_lib/network.py +++ b/client-common/client_lib/network.py @@ -433,12 +433,18 @@ def modify_network(zk_conn, vni, **parameters): zk_data = {} if parameters['description'] != None: zk_data.update({'/networks/{}'.format(vni): parameters['description']}) + if parameters['domain'] != None: + zk_data.update({'/networks/{}/domain'.format(vni): parameters['domain']}) if parameters['ip_network'] != None: zk_data.update({'/networks/{}/ip_network'.format(vni): parameters['ip_network']}) if parameters['ip_gateway'] != None: zk_data.update({'/networks/{}/ip_gateway'.format(vni): parameters['ip_gateway']}) if parameters['dhcp_flag'] != None: zk_data.update({'/networks/{}/dhcp_flag'.format(vni): str(parameters['dhcp_flag'])}) + if parameters['dhcp_start'] != None: + zk_data.update({'/networks/{}/dhcp_start'.format(vni): parameters['dhcp_start']}) + if parameters['dhcp_end'] != None: + zk_data.update({'/networks/{}/dhcp_end'.format(vni): parameters['dhcp_end']}) zkhandler.writedata(zk_conn, zk_data)