vcloud-net-spinner 0.1.2 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG CHANGED
@@ -1,3 +1,13 @@
1
+ 0.1.4 2014-01-09
2
+
3
+ - Documentation changes only.
4
+ - Previous version wasn't published to rubygems.
5
+
6
+ 0.1.3 2013-08-15
7
+
8
+ - License addition
9
+ - Removed the dependency on tree structure
10
+
1
11
  0.1.2 2013-08-13
2
12
 
3
13
  - Exit when no rules provided
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ The MIT License (MIT)
2
+ Copyright (c) 2013 Government Digital Service
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all
12
+ copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18
+ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
20
+ OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -13,60 +13,34 @@ vcloud api.
13
13
  Usage: vcloud-net-spinner [options] API_URL
14
14
  -u, --username=U Vcloud Username
15
15
  -p, --password=P Vcloud Password
16
- -e, --env=E Environment: preview | staging | production
17
- -U, --organization-edgegateway-uuid=U UID: This is required to configure edgegateway services. For more info refer to
18
- docs/find_organisation_edgegateway_uuid
19
- -c, --component=c Environment: lb|firewall|nat
20
- -o, --organization=o Organization: optional. Will default to environment
21
- -d, --rule-directory=d Rules Directory: From where to read the NAT/Firewal/LB rules
22
-
23
- Note: organization maps to the organization name in vcloud. Whereas,
24
- environment maps to your internal environment reference (e.g.
25
- preview, qa, staging, production, etc)
16
+ -U, --organization-edgegateway-uuid=U UID: This is required to configure edgegateway services. For more info refer to docs/find_organisation_edgegateway_uuid
17
+ -c, --component=c Component: lb|firewall|nat
18
+ -o, --organization=o Organization: Name of vcloud organization
19
+ -r, --rules-files file1,file2,file3 Rules Files: files which will contain the rules for the component provided
20
+ -i, --interfaces-files file1,file2,file3 Interfaces Files: files which will contain interfaces
26
21
 
27
22
  ### Example
28
23
 
29
24
  vcloud-net-spinner -u username -p password -e preview -U 1yenz127ynz1872eyz12yz817e -c firewall -o development -d . http://vcloud.vendor.com/api
30
25
 
31
- ### Rules Directory
32
-
33
- A particular rules directory structure could be as follows.
34
-
35
- .
36
- ├── Gemfile
37
- ├── Gemfile.lock
38
- ├── common_firewall.rb
39
- ├── common_lb.rb
40
- ├── common_nat.rb
41
- ├── env1
42
- │ ├── firewall.rb
43
- │ ├── interfaces.yaml
44
- │ ├── lb.rb
45
- │ └── nat.rb
46
- ├── env2
47
- ├── firewall.rb
48
- ├── interfaces.yaml
49
- ├── lb.rb
50
- └── nat.rb
51
-
52
- * Here each environment represent a separate organisation with your vcloud
53
- vendor (eg qa, staging, production). These could have specific rules for nat,
54
- firewall. Also these can have common firewall rules which could be shared
55
- across all environments. A common example of such a situation is internal
56
- network firewall rules are usually shared across environments, whereas
57
- external network firewall rules would be different for all environment.
58
-
59
- * Specific network rules => `env1/firewall.rb`, `env1/nat.rb`, `env1/lb.rb`
60
- * Common network rules => `./common_firewall.rb`, `./common_lb.rb`, `./common_lb.rb`
61
-
62
- * interfaces.yaml file:
63
- To find the urls for network, follow the document at
64
- `docs/find_network_url`
26
+ ### Rules Files & Interfaces Files
27
+
28
+ * You can pass multiple files containing component rules via
29
+ `--rules-files`.
30
+
31
+ * You can specify various files containing network interfaces
32
+ rules via `--interfaces-files`.
33
+
34
+ A particular `interfaces.yaml` file looks as follows:
65
35
 
66
36
  interfaces:
67
37
  Network-1: "https://localhost:4567/api/admin/network/<vdc-network-uuid>"
68
38
  Network-2: "https://localhost:4567/api/admin/network/<vdc-network-uuid>"
69
39
 
40
+ To find the urls for network, follow the document a
41
+ `docs/find_network_url`
42
+
43
+
70
44
  ### DSL
71
45
 
72
46
  #### Firewall
@@ -1,56 +1,82 @@
1
1
  # How to find Network UUID for interfaces.yaml
2
2
 
3
- ## Steps
3
+ There are two networks with vCloud
4
4
 
5
- * vcloud authorization
5
+ - Internal
6
+ - External
6
7
 
7
- curl -v -X POST -d '' -H "Accept: application/*+xml;version=5.1"
8
- -u "{username}@vcloud-org-name:**********"
9
- https://vendor-api-url.net/sessions
8
+ Belows are steps to find both of them
10
9
 
10
+ Using: [VCloud Tools](https://github.com/alphagov/vcloudtools)
11
11
 
12
- The above returns the following information in response
13
- `x-cloud-authorization` and
14
- `<Link rel="down" type="application/vnd.vmware.vcloud.orgList+xml" href="https://vendor-api-url.net/org/"/>`
12
+ ## Internal Networks
15
13
 
14
+ ### Logging into VCloud
16
15
 
17
- * List organisations
16
+ ```
17
+ #$> export VCLOUD_API_ROOT=https://api.vcd.example.com/api eval `vcloud-login`
18
+ Please log into vCloud
19
+ Username: username@organisation
20
+ Password:
21
+ ```
18
22
 
19
- curl -v --insecure
20
- -H "x-vcloud-authorization: {x-vcloud-auth-code}"
21
- -H "Accept: application/*+xml;version=5.1"
22
- "https://vendor-api-url.net/org/"
23
+ ### Finding the organisation uuid
23
24
 
25
+ ```
26
+ #$> vcloud-browse /org | grep MyOrg
27
+ <Org type="application/vnd.vmware.vcloud.org+xml" name="MyOrg" href="https://api.vcd.example.com/api/org/77595ec2-2391-4817-9257-66b12533d684"/>
28
+ ```
24
29
 
25
- This gives the list of organizations you have access to, and you can choose the one you need by using the name attribute `<Org type="application/vnd.vmware.vcloud.org+xml" name="ORG-NAME" href="https://vendor-api-url.net/org/{org-code}"/>`
30
+ In this example, the Org UUID is `77595ec2-2391-4817-9257-66b12533d684`
26
31
 
27
- * Get details of the organisation
32
+ ### Finding the VDC
28
33
 
29
- curl -v --insecure -H "x-vcloud-authorization: {x-vcloud-auth-code}"
30
- -H "Accept: application/*+xml;version=5.1"
31
- "https://vendor-api-url.net/org/{org-code}"
34
+ ```
35
+ #$> vcloud-browse /org/77595ec2-2391-4817-9257-66b12533d684 | grep vnd.vmware.vcloud.vdc+xml
36
+ <Link rel="down" type="application/vnd.vmware.vcloud.vdc+xml" name="VDC1" href="https://api.vcd.example.com/api/vdc/4887d502-5873-4d0c-bb63-075792277ec6"/>
37
+ ```
32
38
 
33
- * This also gives details about various vdc. We would need the one for management vdc:
39
+ ### Finding the Networks in that VDC
34
40
 
35
- <Link rel="down" type="application/vnd.vmware.vcloud.vdc+xml"
36
- name="Management - GDS Development (SL1)"
37
- href="https://vendor-api-url.net/vdc/{vdc-uuid}"/>
38
41
 
39
- * Get vdc details
42
+ ```
43
+ #$> vcloud-browse /vdc/4887d502-5873-4d0c-bb63-075792277ec6
40
44
 
41
- curl -v --insecure -H "x-vcloud-authorization: {x-vcloud-auth-code}"
42
- -H "Accept: application/*+xml;version=5.1"
43
- "https://vendor-api-url.net/vdc/{vdc-uuid}
44
-
45
- * This would provide you with available networks. From which you
46
- can use the name and href attributes for adding to your
47
- interfaces.yaml
48
45
 
49
46
  <AvailableNetworks>
50
- <Network type="application/vnd.vmware.vcloud.network+xml" name="NetworkTest2"
51
- href="https:///vendor-api-url.net/network/{network-uuid-2}"/>
52
- <Network type="application/vnd.vmware.vcloud.network+xml" name="NetworkTest"
53
- href="https:///vendor-api-url.net/network/{network-uuid-1}"/>
47
+ <Network type="application/vnd.vmware.vcloud.network+xml" name="Net2"
48
+ href="https://api.vcd.example.com/api/network/6d0349da-ccd7-4f7a-a4af-71899bf7f12a"/>
49
+ <Network type="application/vnd.vmware.vcloud.network+xml" name="Net1"
50
+ href="https://api.vcd.example.com/api/network/4e376bed-5d4c-4748-9d0d-1469b24f31c0"/>
54
51
  </AvailableNetworks>
55
-
56
-
52
+ ```
53
+
54
+ ## External Networks
55
+
56
+ ### Logging into VCloud
57
+
58
+ ```
59
+ #$> export VCLOUD_API_ROOT=https://api.vcd.example.com/api eval `vcloud-login`
60
+ Please log into vCloud
61
+ Username: username@organisation
62
+ Password:
63
+ ```
64
+
65
+ ### Finding external network uuids
66
+
67
+ ```
68
+ #$> vcloud-browse /admin/extension/externalNetworkReferences
69
+
70
+ <vmext:VMWExternalNetworkReferences ... >
71
+ ...
72
+ <vmext:ExternalNetworkReference
73
+ type="application/vnd.vmware.admin.extension.network+xml"
74
+ name="VC0"
75
+ href="https://vcloud.example.com/api/admin/extension/externalnet/<uuid1>" />
76
+ <vmext:ExternalNetworkReference
77
+ type="application/vnd.vmware.admin.extension.network+xml"
78
+ name="VC1"
79
+ href="https://vcloud.example.com/api/admin/extension/externalnet/<uuid2>" />
80
+ ...
81
+ </vmext:VMWExternalNetworkReferences>
82
+ ```
@@ -1,58 +1,38 @@
1
- # How to find Organisation Edgegateway UUID
1
+ # How to find the Edge Gateway UUID
2
2
 
3
- ##Steps:
3
+ Using: [VCloud Tools](https://github.com/alphagov/vcloudtools)
4
4
 
5
- * vcloud authorization
6
5
 
7
- curl -v -X POST -d '' -H "Accept: application/*+xml;version=5.1"
8
- -u "{username}@vcloud-org-name:**********"
9
- https://vendor-api-url.net/sessions
6
+ ## Logging into VCloud
10
7
 
8
+ ```
9
+ #$> export VCLOUD_API_ROOT=https://api.vcd.example.com/api eval `vcloud-login`
10
+ Please log into vCloud
11
+ Username: username@organisation
12
+ Password:
13
+ ```
11
14
 
12
- The above returns the following information in response
13
- `x-cloud-authorization` and
14
- `<Link rel="down" type="application/vnd.vmware.vcloud.orgList+xml" href="https://vendor-api-url.net/org/"/>`
15
+ ## Finding the organisation uuid
15
16
 
17
+ ```
18
+ #$> vcloud-browse /org | grep MyOrg
19
+ <Org type="application/vnd.vmware.vcloud.org+xml" name="MyOrg" href="https://api.vcd.example.com/api/org/77595ec2-2391-4817-9257-66b12533d684"/>
20
+ ```
16
21
 
17
- * List organisations
22
+ In this example, the Org UUID is `77595ec2-2391-4817-9257-66b12533d684`
18
23
 
19
- curl -v --insecure
20
- -H "x-vcloud-authorization: {x-vcloud-auth-code}"
21
- -H "Accept: application/*+xml;version=5.1"
22
- "https://vendor-api-url.net/org/"
23
-
24
-
25
- This gives the list of organizations you have access to, and you can choose the one you need by using the name attribute `<Org type="application/vnd.vmware.vcloud.org+xml" name="ORG-NAME" href="https://vendor-api-url.net/org/{org-code}"/>`
26
-
27
- * Get details of the organisation
28
-
29
- curl -v --insecure -H "x-vcloud-authorization: {x-vcloud-auth-code}"
30
- -H "Accept: application/*+xml;version=5.1"
31
- "https://vendor-api-url.net/org/{org-code}"
32
-
33
- * This also gives details about various vdc. We would need the one for management vdc:
34
-
35
- <Link rel="down" type="application/vnd.vmware.vcloud.vdc+xml"
36
- name="Management - GDS Development (SL1)"
37
- href="https://vendor-api-url.net/vdc/{org-code}"/>
38
-
39
- * Retrieve edgegateway record
40
-
41
- curl -v --insecure -H "x-vcloud-authorization: {x-vcloud-auth-code}="
42
- -H "Accept: application/*+xml;version=5.1"
43
- "https://vendor-api-url.net/admin/vdc/{management-edgegateway-uuid}/edgeGateways"
44
-
45
- * Response of the above is (from which you would need the id in the href attribute):
46
-
47
- <EdgeGatewayRecord vdc="https://vendor-api-url.net/vdc/{management-edgegateway-uuid}"
48
- numberOfOrgNetworks="8" numberOfExtNetworks="1"
49
- name="GDS Development Gateway" isBusy="false" haStatus="UP" gatewayStatus="READY"
50
- href="https://vendor-api-url.net/admin/edgeGateway/{id}"
51
- isSyslogServerSettingInSync="true" taskStatus="success"
52
- taskOperation="networkConfigureEdgeGatewayServices"
53
- task="https://vendor-api-url.net/task/***" taskDetails=" "/>
54
-
55
- *e.g. https://vendor-api-url.net/admin/edgeGateway/{id}*
24
+ ## Finding the VDC UUID
56
25
 
26
+ ```
27
+ #$> vcloud-browse /org/77595ec2-2391-4817-9257-66b12533d684 | grep vnd.vmware.vcloud.vdc+xml
28
+ <Link rel="down" type="application/vnd.vmware.vcloud.vdc+xml" name="VDC1" href="https://api.vcd.example.com/api/vdc/4887d502-5873-4d0c-bb63-075792277ec6"/>
29
+ ```
30
+ In this example, the VDC UUID is `4887d502-5873-4d0c-bb63-075792277ec6`
57
31
 
32
+ ## Find the Edge Gateway UUID
58
33
 
34
+ ```
35
+ #$> vcloud-browse /admin/vdc/4887d502-5873-4d0c-bb63-075792277ec6/edgeGateways\?format=references | grep 'EdgeGatewayReference '
36
+ <EdgeGatewayReference type="application/vnd.vmware.admin.edgeGateway+xml" name="My VSE (nft00012a3)" id="urn:vcloud:gateway:be8e9731-0f3d-474b-b739-085afd27cdfd" href="https://api.vcd.example.com/api/admin/edgeGateway/be8e9731-0f3d-474b-b739-085afd27cdfd"/>
37
+ ```
38
+ In this example, the Edge Gateway UUID is `be8e9731-0f3d-474b-b739-085afd27cdfd`
@@ -29,25 +29,25 @@ class VcloudNetworkConfigurator
29
29
  @options[:password] = v
30
30
  end
31
31
 
32
- o.on("-e", "--env=E", String, "Environment: name by which you would refer your environment as (also used for tree structure)") do |v|
33
- @options[:environment] = v
34
- end
35
-
36
32
  o.on("-U", "--organization-edgegateway-uuid=U",
37
33
  "UID: This is required to configure edgegateway services. For more info refer to docs/find_organisation_edgegateway_uuid") do |v|
38
34
  @options[:org_edgegateway_uuid] = v
39
35
  end
40
36
 
41
- o.on("-c", "--component=c", ["lb", "firewall", "nat"], "Environment: lb|firewall|nat") do |v|
37
+ o.on("-c", "--component=c", ["lb", "firewall", "nat"], "Component: lb|firewall|nat") do |v|
42
38
  @options[:component] = v
43
39
  end
44
40
 
45
- o.on("-o", "--organization=o", "Organization: optional. Will default to environment") do |v|
41
+ o.on("-o", "--organization=o", "Organization: Name of vcloud organization") do |v|
46
42
  @options[:organization] = v
47
43
  end
48
44
 
49
- o.on("-d", "--rule-directory=d", "Rules Directory: From where to read the NAT/Firewal/LB rules") do |v|
50
- @options[:rules_directory] = v
45
+ o.on("-r", "--rules-files file1,file2,file3", Array, "Rules Files: files which will contain the rules for the component provided") do |v|
46
+ @options[:rules_files] = v
47
+ end
48
+
49
+ o.on("-i", "--interfaces-files file1,file2,file3", Array, "Interfaces Files: files which will contain interfaces") do |v|
50
+ @options[:interfaces_files] = v
51
51
  end
52
52
  end
53
53
 
@@ -57,8 +57,6 @@ class VcloudNetworkConfigurator
57
57
  else
58
58
  raise Exception.new("No API_URL provided. See help for more details")
59
59
  end
60
-
61
- @options[:organization] ||= @options[:environment]
62
60
  end
63
61
 
64
62
  end
@@ -11,7 +11,7 @@ class EdgeGateway
11
11
 
12
12
  def apply_configuration
13
13
  auth_header = authorize_request
14
- configure_request = VcloudConfigureRequest.new(@vcloud_settings, auth_header, @options[:environment], @options[:component], @options[:rules_directory])
14
+ configure_request = VcloudConfigureRequest.new(@vcloud_settings, auth_header, @options[:component], @options[:rules_files], @options[:interfaces_files])
15
15
  configure_request.submit
16
16
 
17
17
  if configure_request.success?
@@ -24,7 +24,6 @@ class VcloudAuthRequest
24
24
  end
25
25
 
26
26
  puts "HTTP #{response.code}"
27
- puts response
28
27
  @response = response
29
28
  end
30
29
 
@@ -2,19 +2,22 @@ require "net/http"
2
2
  require 'yaml'
3
3
 
4
4
  class VcloudConfigureRequest
5
- def initialize vcloud_settings, auth_header, environment, component, rules_directory
5
+ def initialize vcloud_settings, auth_header, component, rules_files, interfaces_files
6
6
  @auth_header = auth_header
7
7
  @config_url = vcloud_settings.edge_gateway_config_url
8
- @environment = environment
9
8
  @component = component
10
9
  @response = nil
11
10
 
11
+ @interfaces = {}
12
+ interfaces_files.each do |ifile|
13
+ @interfaces.merge!(YAML::load_file(ifile)['interfaces']) if ifile and File.file?(File.expand_path(ifile))
14
+ end if interfaces_files
12
15
 
13
- @interfaces = File.file?("#{rules_directory}/#{@environment}/interfaces.yaml") ?
14
- YAML::load_file("#{rules_directory}/#{@environment}/interfaces.yaml")['interfaces'] : {}
15
-
16
- require "#{rules_directory}/common_#{component}.rb" if File.file?("#{rules_directory}/common_#{component}.rb")
17
- require "#{rules_directory}/#{@environment}/#{component}" if File.file?("#{rules_directory}/#{@environment}/#{component}.rb")
16
+ rules_files.each do |rfile|
17
+ next if rfile.nil?
18
+ expanded_rfile = File.expand_path(rfile)
19
+ require expanded_rfile if File.file?(expanded_rfile)
20
+ end if rules_files
18
21
  end
19
22
 
20
23
  def components
@@ -1 +1 @@
1
- VERSION = '0.1.2'
1
+ VERSION = '0.1.4'
@@ -15,8 +15,7 @@ describe "happy path" do
15
15
  end
16
16
 
17
17
  it "should abort on failure of authorization" do
18
- args = ["-u", "super", "-p", "man", "-U", "123321", "-d",
19
- "spec/integration/test_data/rules_dir", "-e", "preview",
18
+ args = ["-u", "super", "-p", "man", "-U", "123321", "-o", "preview",
20
19
  "-c", "firewall", "https://www.vcloud.eggplant.com"]
21
20
 
22
21
  configurator = VcloudNetworkConfigurator.new(args)
@@ -7,7 +7,7 @@ describe "happy path" do
7
7
  WebMock.disable_net_connect!
8
8
  WebMock.reset!
9
9
 
10
- session_url = "https://super%40preview:man@www.vcloud.eggplant.com/sessions"
10
+ session_url = "https://super%40org-name:man@www.vcloud.eggplant.com/sessions"
11
11
  edge_gateway_configure_url = "https://www.vcloud.eggplant.com/admin/edgeGateway/123321/action/configureServices"
12
12
  task_url = "https://www.vcloud.eggplant.com/api/tasks/10"
13
13
 
@@ -31,8 +31,9 @@ describe "happy path" do
31
31
  end
32
32
 
33
33
  it "should configure edgegateway successfully" do
34
- args = ["-u", "super", "-p", "man", "-U", "123321", "-d",
35
- "spec/integration/test_data/rules_dir", "-e", "preview",
34
+ args = ["-u", "super", "-p", "man", "-U", "123321", "-r",
35
+ "spec/integration/test_data/rules_dir/common_firewall.rb,spec/integration/test_data/rules_dir/preview/firewall.rb",
36
+ "-o", "org-name",
36
37
  "-c", "firewall", "https://www.vcloud.eggplant.com"]
37
38
 
38
39
  configurator = VcloudNetworkConfigurator.new(args)
@@ -7,7 +7,7 @@ describe "happy path for lb configurations" do
7
7
  WebMock.disable_net_connect!
8
8
  WebMock.reset!
9
9
 
10
- session_url = "https://super%40preview:man@www.vcloud.eggplant.com/sessions"
10
+ session_url = "https://super%40org-name:man@www.vcloud.eggplant.com/sessions"
11
11
  edge_gateway_configure_url = "https://www.vcloud.eggplant.com/admin/edgeGateway/123321/action/configureServices"
12
12
  task_url = "https://www.vcloud.eggplant.com/api/tasks/10"
13
13
 
@@ -31,8 +31,10 @@ describe "happy path for lb configurations" do
31
31
  end
32
32
 
33
33
  it "should configure edgegateway successfully" do
34
- args = ["-u", "super", "-p", "man", "-U", "123321", "-d",
35
- "spec/integration/test_data/rules_dir", "-e", "preview",
34
+ args = ["-u", "super", "-p", "man", "-U", "123321", "-r",
35
+ "spec/integration/test_data/rules_dir/common_lb.rb,spec/integration/test_data/rules_dir/preview/lb.rb",
36
+ "-i", "spec/integration/test_data/rules_dir/preview/interfaces.yaml",
37
+ "-o", "org-name",
36
38
  "-c", "lb", "https://www.vcloud.eggplant.com"]
37
39
 
38
40
  configurator = VcloudNetworkConfigurator.new(args)
@@ -31,8 +31,10 @@ describe "happy path for nat configurations" do
31
31
  end
32
32
 
33
33
  it "should configure edgegateway successfully" do
34
- args = ["-u", "super", "-p", "man", "-U", "123321", "-d",
35
- "spec/integration/test_data/rules_dir", "-e", "preview",
34
+ args = ["-u", "super", "-p", "man", "-U", "123321", "-r",
35
+ "spec/integration/test_data/rules_dir/common_nat.rb,spec/integration/test_data/rules_dir/preview/nat.rb",
36
+ "-i", "spec/integration/test_data/rules_dir/preview/interfaces.yaml",
37
+ "-o", "preview",
36
38
  "-c", "nat", "https://www.vcloud.eggplant.com"]
37
39
 
38
40
  configurator = VcloudNetworkConfigurator.new(args)
@@ -22,7 +22,7 @@ describe EdgeGateway do
22
22
  auth_request.should_receive(:auth_response).and_return({'x-vcloud-authorization' => '123213'})
23
23
 
24
24
  VcloudConfigureRequest.should_receive(:new).
25
- with(vs, '123213', 'farm', 'firewall', 'path/to/dir').
25
+ with(vs, '123213', 'firewall', 'path/to/rules', 'path/to/interfaces').
26
26
  and_return(mock(:submit => true, :success? => true, :response_body => nil))
27
27
 
28
28
  EdgeGateway.any_instance.stub(:check_for_success => true)
@@ -31,10 +31,10 @@ describe EdgeGateway do
31
31
  :org_edgegateway_uuid => '123321',
32
32
  :username => 'bringle',
33
33
  :password => 'eggplant',
34
- :environment => 'farm',
35
34
  :organization => 'gds-aubergine',
36
35
  :component => 'firewall',
37
- :rules_directory => 'path/to/dir',
36
+ :rules_files => 'path/to/rules',
37
+ :interfaces_files => 'path/to/interfaces',
38
38
  })
39
39
  eg.apply_configuration
40
40
  end
@@ -2,10 +2,15 @@ require 'spec_helper'
2
2
 
3
3
  describe 'VcloudConfigureRequest' do
4
4
  describe "#initialize" do
5
+ it "should initialize without error out if files are not passed as parameters" do
6
+ expect {
7
+ request = VcloudConfigureRequest.new mock(:edge_gateway_config_url => true),
8
+ 'auth-header', 'firewall', nil, nil }.to_not raise_error
9
+ end
5
10
  it "should initialize without error out if files it requires are not present" do
6
11
  expect {
7
12
  request = VcloudConfigureRequest.new mock(:edge_gateway_config_url => true),
8
- 'auth-header', 'env', 'firewall', './this-is-no-path' }.to_not raise_error
13
+ 'auth-header', 'firewall', ['no-rules-path'], ['no-interfaces-path'] }.to_not raise_error
9
14
  end
10
15
  end
11
16
 
@@ -15,7 +20,7 @@ describe 'VcloudConfigureRequest' do
15
20
  Net::HTTP.should_not_receive(:new)
16
21
 
17
22
  request = VcloudConfigureRequest.new mock(:edge_gateway_config_url => true),
18
- 'auth-header', 'env', 'firewall', './this-is-no-path'
23
+ 'auth-header', 'firewall', ['no-rules'], ['no-interface']
19
24
  expect { request.submit }.to raise_error(SystemExit, "No rules found. exiting")
20
25
  end
21
26
  end
@@ -19,6 +19,8 @@ Gem::Specification.new do |s|
19
19
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
20
  s.require_paths = ["lib"]
21
21
 
22
+ s.license = 'MIT'
23
+
22
24
  s.add_development_dependency "rake"
23
25
  s.add_development_dependency "minitest"
24
26
  s.add_development_dependency "mocha"
metadata CHANGED
@@ -1,141 +1,190 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: vcloud-net-spinner
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.4
4
5
  prerelease:
5
- version: 0.1.2
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Garima Singh
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2013-08-13 00:00:00 Z
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
12
+ date: 2014-01-09 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
16
15
  name: rake
17
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
18
17
  none: false
19
- requirements:
20
- - - ">="
21
- - !ruby/object:Gem::Version
22
- version: "0"
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
23
22
  type: :development
24
23
  prerelease: false
25
- version_requirements: *id001
26
- - !ruby/object:Gem::Dependency
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
27
31
  name: minitest
28
- requirement: &id002 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
29
33
  none: false
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: "0"
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
34
38
  type: :development
35
39
  prerelease: false
36
- version_requirements: *id002
37
- - !ruby/object:Gem::Dependency
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
38
47
  name: mocha
39
- requirement: &id003 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
40
49
  none: false
41
- requirements:
42
- - - ">="
43
- - !ruby/object:Gem::Version
44
- version: "0"
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
45
54
  type: :development
46
55
  prerelease: false
47
- version_requirements: *id003
48
- - !ruby/object:Gem::Dependency
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
49
63
  name: webmock
50
- requirement: &id004 !ruby/object:Gem::Requirement
64
+ requirement: !ruby/object:Gem::Requirement
51
65
  none: false
52
- requirements:
53
- - - ">="
54
- - !ruby/object:Gem::Version
55
- version: "0"
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
56
70
  type: :development
57
71
  prerelease: false
58
- version_requirements: *id004
59
- - !ruby/object:Gem::Dependency
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ - !ruby/object:Gem::Dependency
60
79
  name: rspec
61
- requirement: &id005 !ruby/object:Gem::Requirement
80
+ requirement: !ruby/object:Gem::Requirement
62
81
  none: false
63
- requirements:
82
+ requirements:
64
83
  - - ~>
65
- - !ruby/object:Gem::Version
84
+ - !ruby/object:Gem::Version
66
85
  version: 2.11.0
67
86
  type: :development
68
87
  prerelease: false
69
- version_requirements: *id005
70
- - !ruby/object:Gem::Dependency
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ~>
92
+ - !ruby/object:Gem::Version
93
+ version: 2.11.0
94
+ - !ruby/object:Gem::Dependency
71
95
  name: equivalent-xml
72
- requirement: &id006 !ruby/object:Gem::Requirement
96
+ requirement: !ruby/object:Gem::Requirement
73
97
  none: false
74
- requirements:
98
+ requirements:
75
99
  - - ~>
76
- - !ruby/object:Gem::Version
100
+ - !ruby/object:Gem::Version
77
101
  version: 0.2.9
78
102
  type: :development
79
103
  prerelease: false
80
- version_requirements: *id006
81
- - !ruby/object:Gem::Dependency
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ~>
108
+ - !ruby/object:Gem::Version
109
+ version: 0.2.9
110
+ - !ruby/object:Gem::Dependency
82
111
  name: gem_publisher
83
- requirement: &id007 !ruby/object:Gem::Requirement
112
+ requirement: !ruby/object:Gem::Requirement
84
113
  none: false
85
- requirements:
114
+ requirements:
86
115
  - - ~>
87
- - !ruby/object:Gem::Version
116
+ - !ruby/object:Gem::Version
88
117
  version: 1.3.0
89
118
  type: :development
90
119
  prerelease: false
91
- version_requirements: *id007
92
- - !ruby/object:Gem::Dependency
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ~>
124
+ - !ruby/object:Gem::Version
125
+ version: 1.3.0
126
+ - !ruby/object:Gem::Dependency
93
127
  name: parallel
94
- requirement: &id008 !ruby/object:Gem::Requirement
128
+ requirement: !ruby/object:Gem::Requirement
95
129
  none: false
96
- requirements:
97
- - - ">="
98
- - !ruby/object:Gem::Version
99
- version: "0"
130
+ requirements:
131
+ - - ! '>='
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
100
134
  type: :runtime
101
135
  prerelease: false
102
- version_requirements: *id008
103
- - !ruby/object:Gem::Dependency
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ! '>='
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ - !ruby/object:Gem::Dependency
104
143
  name: highline
105
- requirement: &id009 !ruby/object:Gem::Requirement
144
+ requirement: !ruby/object:Gem::Requirement
106
145
  none: false
107
- requirements:
108
- - - ">="
109
- - !ruby/object:Gem::Version
110
- version: "0"
146
+ requirements:
147
+ - - ! '>='
148
+ - !ruby/object:Gem::Version
149
+ version: '0'
111
150
  type: :runtime
112
151
  prerelease: false
113
- version_requirements: *id009
114
- - !ruby/object:Gem::Dependency
152
+ version_requirements: !ruby/object:Gem::Requirement
153
+ none: false
154
+ requirements:
155
+ - - ! '>='
156
+ - !ruby/object:Gem::Version
157
+ version: '0'
158
+ - !ruby/object:Gem::Dependency
115
159
  name: nokogiri
116
- requirement: &id010 !ruby/object:Gem::Requirement
160
+ requirement: !ruby/object:Gem::Requirement
117
161
  none: false
118
- requirements:
162
+ requirements:
119
163
  - - ~>
120
- - !ruby/object:Gem::Version
164
+ - !ruby/object:Gem::Version
121
165
  version: 1.5.0
122
166
  type: :runtime
123
167
  prerelease: false
124
- version_requirements: *id010
125
- description: It allows one to right rules for firewall, NAT and load balancer using vcloud API and configure them on the vendor end
126
- email:
168
+ version_requirements: !ruby/object:Gem::Requirement
169
+ none: false
170
+ requirements:
171
+ - - ~>
172
+ - !ruby/object:Gem::Version
173
+ version: 1.5.0
174
+ description: It allows one to right rules for firewall, NAT and load balancer using
175
+ vcloud API and configure them on the vendor end
176
+ email:
127
177
  - igarimasingh@gmail.com
128
- executables:
178
+ executables:
129
179
  - vcloud-net-spinner
130
180
  extensions: []
131
-
132
181
  extra_rdoc_files: []
133
-
134
- files:
182
+ files:
135
183
  - .gitignore
136
184
  - .travis.yml
137
185
  - CHANGELOG
138
186
  - Gemfile
187
+ - LICENSE
139
188
  - README.md
140
189
  - Rakefile
141
190
  - bin/vcloud-net-spinner
@@ -179,37 +228,34 @@ files:
179
228
  - spec/vcloud_network_configurator/vcloud_settings_spec.rb
180
229
  - vcloud-net-spinner.gemspec
181
230
  homepage: https://github.com/alphagov/vcloud-net-spinner
182
- licenses: []
183
-
231
+ licenses:
232
+ - MIT
184
233
  post_install_message:
185
234
  rdoc_options: []
186
-
187
- require_paths:
235
+ require_paths:
188
236
  - lib
189
- required_ruby_version: !ruby/object:Gem::Requirement
237
+ required_ruby_version: !ruby/object:Gem::Requirement
190
238
  none: false
191
- requirements:
192
- - - ">="
193
- - !ruby/object:Gem::Version
194
- hash: 1395496110458740989
195
- segments:
239
+ requirements:
240
+ - - ! '>='
241
+ - !ruby/object:Gem::Version
242
+ version: '0'
243
+ segments:
196
244
  - 0
197
- version: "0"
198
- required_rubygems_version: !ruby/object:Gem::Requirement
245
+ hash: 2270830597403482561
246
+ required_rubygems_version: !ruby/object:Gem::Requirement
199
247
  none: false
200
- requirements:
201
- - - ">="
202
- - !ruby/object:Gem::Version
203
- hash: 1395496110458740989
204
- segments:
248
+ requirements:
249
+ - - ! '>='
250
+ - !ruby/object:Gem::Version
251
+ version: '0'
252
+ segments:
205
253
  - 0
206
- version: "0"
254
+ hash: 2270830597403482561
207
255
  requirements: []
208
-
209
256
  rubyforge_project: vcloud-net-spinner
210
- rubygems_version: 1.8.24
257
+ rubygems_version: 1.8.23
211
258
  signing_key:
212
259
  specification_version: 3
213
260
  summary: Configure firewall, NAT and load balancer for vcloud
214
261
  test_files: []
215
-