From 800246ea600ff3efaa4eda85b2ec44313dcc0a8f Mon Sep 17 00:00:00 2001 From: Javi Fontan Date: Mon, 6 Oct 2014 15:57:04 +0200 Subject: [PATCH] feature #3202: add options to onevnet addar command * --gateway ip * --netmask mask * --vlan * --vlanid id --- src/cli/one_helper/onevnet_helper.rb | 30 ++++++++++++++++++++++++++++ src/cli/onevnet | 9 ++++++--- 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/src/cli/one_helper/onevnet_helper.rb b/src/cli/one_helper/onevnet_helper.rb index 925acee830..bec5f36244 100644 --- a/src/cli/one_helper/onevnet_helper.rb +++ b/src/cli/one_helper/onevnet_helper.rb @@ -82,6 +82,36 @@ class OneVNetHelper < OpenNebulaHelper::OneHelper # :description => "Number of addresses to reserve" # } + GATEWAY = [ + :name => "gateway", + :large => "--gateway ip", + :format => String, + :description=> "IP of the gateway" + ] + + NETMASK = [ + :name => "netmask", + :large => "--netmask mask", + :format => String, + :description=> "Netmask in dot notation" + ] + + VLAN = [ + :name => "vlan", + :large => "--vlan", + :description=> "Use network isolation" + ] + + VLAN_ID = [ + :name => "vlanid", + :large => "--vlanid id", + :format => String, + :description=> "VLAN ID assigned" + ] + + ADDAR_OPTIONS = [ + SIZE, MAC, IP, IP6_GLOBAL, IP6_ULA, GATEWAY, NETMASK, VLAN, VLAN_ID ] + def self.rname "VNET" end diff --git a/src/cli/onevnet b/src/cli/onevnet index e426ae17ea..cf8acc608a 100755 --- a/src/cli/onevnet +++ b/src/cli/onevnet @@ -112,9 +112,8 @@ cmd=CommandParser::CmdParser.new(ARGV) do Adds an address range to the Virtual Network EOT - command :addar, addar_desc, :vnetid, :options=>STD_OPTIONS + [OneVNetHelper::SIZE, - OneVNetHelper::MAC, OneVNetHelper::IP, OneVNetHelper::IP6_GLOBAL, - OneVNetHelper::IP6_ULA ] do + command :addar, addar_desc, :vnetid, + :options => STD_OPTIONS + OneVNetHelper::ADDAR_OPTIONS do helper.perform_action(args[0],options,"lease added") do |vn| ar = "AR = [ " @@ -143,6 +142,10 @@ cmd=CommandParser::CmdParser.new(ARGV) do ar << ", MAC = " << options[:mac] if options[:mac] ar << ", GLOBAL_PREFIX = " << options[:ip6_global] if options[:ip6_global] ar << ", ULA_PREFIX = " << options[:ip6_ula] if options[:ip6_ula] + ar << ", GATEWAY = " << options[:gateway] if options[:gateway] + ar << ", NETMASK = " << options[:netmask] if options[:netmask] + ar << ", VLAN = YES" if options[:vlan] + ar << ", VLAN_ID = " << options[:vlanid] if options[:vlanid] ar << "]"