From cde5fc17fe235405703c67184c81d85643b257a2 Mon Sep 17 00:00:00 2001 From: elijah Date: Thu, 11 Oct 2012 00:43:05 -0700 Subject: new test/provider data --- test/provider/common.json | 10 +++--- .../files/public-definitions/provider.json.erb | 1 - .../files/service-definitions/provider.json.erb | 39 ++++++++++++++++++++++ test/provider/hiera/couch1.yaml | 6 ++-- test/provider/hiera/couch2.yaml | 6 ++-- test/provider/hiera/ns1.yaml | 21 +++++++----- test/provider/hiera/ns2.yaml | 21 +++++++----- test/provider/hiera/vpn1.yaml | 6 ++-- test/provider/hiera/web1.yaml | 31 +++++++++++++++-- test/provider/provider.json | 10 ++++-- test/provider/services/couchdb.json | 2 +- test/provider/services/dns.json | 7 ++-- test/provider/services/openvpn.json | 7 ++-- test/provider/services/webapp.json | 11 ++++-- 14 files changed, 136 insertions(+), 42 deletions(-) delete mode 100644 test/provider/files/public-definitions/provider.json.erb create mode 100644 test/provider/files/service-definitions/provider.json.erb (limited to 'test') diff --git a/test/provider/common.json b/test/provider/common.json index e8f5519..6b1488e 100644 --- a/test/provider/common.json +++ b/test/provider/common.json @@ -1,11 +1,13 @@ # # Options put here are inherited by all nodes. -# # "fqdn": "= name + '.' + (public_dns ? domain_public : domain_internal)" +# { "domain": { "public": "rewire.co", - "internal": "rewire" + "internal": "rewire", + "name": "= node.name + '.' + (dns.public ? domain.public : domain.internal)" }, - "public_dns": true, - "fqdn": "= name + '.' + (public_dns ? domain['public'] : domain['internal'])" + "dns": { + "public": "= service_type != 'internal_service'" + } } diff --git a/test/provider/files/public-definitions/provider.json.erb b/test/provider/files/public-definitions/provider.json.erb deleted file mode 100644 index 0b8eeb6..0000000 --- a/test/provider/files/public-definitions/provider.json.erb +++ /dev/null @@ -1 +0,0 @@ -todo: implement template support. \ No newline at end of file diff --git a/test/provider/files/service-definitions/provider.json.erb b/test/provider/files/service-definitions/provider.json.erb new file mode 100644 index 0000000..e884524 --- /dev/null +++ b/test/provider/files/service-definitions/provider.json.erb @@ -0,0 +1,39 @@ +<%= + hsh = {} + + # grab some fields from provider.json + hsh = global.provider.pick(:languages, :description, :name, :enrollment_policy) + + # typically this is specified in common.json + hsh['domain'] = domain.public + + # advertise services that are 'user services' + hsh['services'] = global.services[:service_type => :user_service].field(:name) + + hsh['api_version'] = "1" + hsh['api_uri'] = "https://" + api_domain + + #hsh['ca_cert_uri'] = + #hsh['ca_cert_fingerprint'] = + + # { + # "serial": 1, + # "version": "0.1.0", + # "domain": "springbok", + # "languages": ["en"], + # "display_name": { + # "en": "Test Provider" + # }, + # "description": { + # "en": "This is a test provider" + # }, + # "enrollment_policy": "open", + # "services": ["eip"], + # "api_version": "1.0.0", + # "api_uri": "https://94.103.43.3", + # "ca_cert_fingerprint": "SHA256 Fingerprint=19:F1:44:AA:57:DD:59:65:3B:07:5F:25:5D:02:D2:3F:FB:E6:A6:DA:FE:67:35:F2:7D:D7:8B:0E:BF:2B:E5:3C", + # "ca_cert_uri": "https://springbok/ca.crt" + # } + + generate_json hsh +%> \ No newline at end of file diff --git a/test/provider/hiera/couch1.yaml b/test/provider/hiera/couch1.yaml index a954a14..0a6213c 100644 --- a/test/provider/hiera/couch1.yaml +++ b/test/provider/hiera/couch1.yaml @@ -1,9 +1,11 @@ --- +dns: + public: false domain: internal: rewire + name: couch1.rewire public: rewire.co -fqdn: couch1.rewire ip_address: 245.2.45.42 name: couch1 -public_dns: false +service_type: internal_service services: couchdb diff --git a/test/provider/hiera/couch2.yaml b/test/provider/hiera/couch2.yaml index 208e64c..212b057 100644 --- a/test/provider/hiera/couch2.yaml +++ b/test/provider/hiera/couch2.yaml @@ -1,9 +1,11 @@ --- +dns: + public: false domain: internal: rewire + name: couch2.rewire public: rewire.co -fqdn: couch2.rewire ip_address: 73.45.87.11 name: couch2 -public_dns: false +service_type: internal_service services: couchdb diff --git a/test/provider/hiera/ns1.yaml b/test/provider/hiera/ns1.yaml index 721e721..da996a6 100644 --- a/test/provider/hiera/ns1.yaml +++ b/test/provider/hiera/ns1.yaml @@ -1,26 +1,31 @@ --- +dns: + public: true domain: internal: rewire + name: ns1.rewire.co public: rewire.co -fqdn: ns1.rewire.co hosts: private: - - fqdn: couch1.rewire + - domain_name: couch1.rewire ip_address: 245.2.45.42 - - fqdn: couch2.rewire + - domain_name: couch2.rewire ip_address: 73.45.87.11 public: - - fqdn: ns1.rewire.co + - domain_name: ns1.rewire.co ip_address: 1.1.1.1 - - fqdn: ns2.rewire.co + - domain_name: ns2.rewire.co ip_address: 1.1.1.2 - - fqdn: vpn1.rewire.co + - domain_name: vpn1.rewire.co ip_address: 2.2.2.2 - - fqdn: web1.rewire.co + - dns_aliases: + - rewire.co + - api.rewire.co + domain_name: web1.rewire.co ip_address: 6.6.7.7 ip_address: 1.1.1.1 name: ns1 production: true -public_dns: true +service_type: public_service services: dns tags: production diff --git a/test/provider/hiera/ns2.yaml b/test/provider/hiera/ns2.yaml index b64a238..bac04d4 100644 --- a/test/provider/hiera/ns2.yaml +++ b/test/provider/hiera/ns2.yaml @@ -1,26 +1,31 @@ --- +dns: + public: true domain: internal: rewire + name: ns2.rewire.co public: rewire.co -fqdn: ns2.rewire.co hosts: private: - - fqdn: couch1.rewire + - domain_name: couch1.rewire ip_address: 245.2.45.42 - - fqdn: couch2.rewire + - domain_name: couch2.rewire ip_address: 73.45.87.11 public: - - fqdn: ns1.rewire.co + - domain_name: ns1.rewire.co ip_address: 1.1.1.1 - - fqdn: ns2.rewire.co + - domain_name: ns2.rewire.co ip_address: 1.1.1.2 - - fqdn: vpn1.rewire.co + - domain_name: vpn1.rewire.co ip_address: 2.2.2.2 - - fqdn: web1.rewire.co + - dns_aliases: + - rewire.co + - api.rewire.co + domain_name: web1.rewire.co ip_address: 6.6.7.7 ip_address: 1.1.1.2 name: ns2 production: true -public_dns: true +service_type: public_service services: dns tags: production diff --git a/test/provider/hiera/vpn1.yaml b/test/provider/hiera/vpn1.yaml index d21d4f6..a2e226d 100644 --- a/test/provider/hiera/vpn1.yaml +++ b/test/provider/hiera/vpn1.yaml @@ -1,8 +1,10 @@ --- +dns: + public: true domain: internal: rewire + name: vpn1.rewire.co public: rewire.co -fqdn: vpn1.rewire.co ip_address: 2.2.2.2 name: vpn1 openvpn: @@ -155,6 +157,6 @@ openvpn: -----END RSA PRIVATE KEY----- production: true -public_dns: true +service_type: user_service services: openvpn tags: production diff --git a/test/provider/hiera/web1.yaml b/test/provider/hiera/web1.yaml index 88c75d5..1b12e3e 100644 --- a/test/provider/hiera/web1.yaml +++ b/test/provider/hiera/web1.yaml @@ -1,13 +1,38 @@ --- +api_domain: api.rewire.co definition_files: - provider: <%= {:hi => 'yes'}.to_json %> + eip_service: file('service-definitions/eip-service.json.erb') + provider: |- + { + "api_uri": "https://api.rewire.co", + "api_version": "1", + "description": { + "en": "A demonstration service provider using the LEAP platform" + }, + "domain": "rewire.co", + "enrollment_policy": "open", + "languages": [ + "en" + ], + "name": { + "en": "The Rewire Company" + }, + "services": [ + "openvpn" + ] + } +dns: + aliases: + - rewire.co + - api.rewire.co + public: true domain: internal: rewire + name: web1.rewire.co public: rewire.co -fqdn: web1.rewire.co ip_address: 6.6.7.7 name: web1 -public_dns: true +service_type: public_service services: webapp webapp: couchdb_hosts: diff --git a/test/provider/provider.json b/test/provider/provider.json index 58b6728..4e8bb34 100644 --- a/test/provider/provider.json +++ b/test/provider/provider.json @@ -2,9 +2,15 @@ # General service provider configuration. # { - "name": "The Rewire Company", - "description": "A demonstration service provider using the LEAP platform", + "name": { + "en": "The Rewire Company" + }, + "description": { + "en": "A demonstration service provider using the LEAP platform" + }, "languages": ["en"], + "default_language": "en", + "enrollment_policy": "open", "ca": { "name": "Rewire Root CA", "organization": "#{name}", diff --git a/test/provider/services/couchdb.json b/test/provider/services/couchdb.json index 7c13c8d..9024aa0 100644 --- a/test/provider/services/couchdb.json +++ b/test/provider/services/couchdb.json @@ -1,3 +1,3 @@ { - "public_dns": false + "service_type": "internal_service" } \ No newline at end of file diff --git a/test/provider/services/dns.json b/test/provider/services/dns.json index 3fea381..677d9b2 100644 --- a/test/provider/services/dns.json +++ b/test/provider/services/dns.json @@ -1,6 +1,7 @@ { "hosts": { - "public": "= nodes[:public_dns => true].fields(:fqdn, :dns_alias, :ip_address)", - "private": "= nodes[:public_dns => false].fields(:fqdn, :dns_alias, :ip_address)" - } + "public": "= nodes['dns.public' => true].fields('domain.name', 'dns.aliases', 'ip_address')", + "private": "= nodes['dns.public' => false].fields('domain.name', 'dns.aliases', 'ip_address')" + }, + "service_type": "public_service" } \ No newline at end of file diff --git a/test/provider/services/openvpn.json b/test/provider/services/openvpn.json index ffaa313..e7e8150 100644 --- a/test/provider/services/openvpn.json +++ b/test/provider/services/openvpn.json @@ -5,7 +5,8 @@ "nat": true, "ca_crt": "= file 'ca/ca.crt'", "ca_key": "= file 'ca/ca.key'", - "server_crt": "= file fqdn + '.crt'", - "server_key": "= file fqdn + '.key'" - } + "server_crt": "= file domain.name + '.crt'", + "server_key": "= file domain.name + '.key'" + }, + "service_type": "user_service" } diff --git a/test/provider/services/webapp.json b/test/provider/services/webapp.json index 5a045b2..bfd701d 100644 --- a/test/provider/services/webapp.json +++ b/test/provider/services/webapp.json @@ -1,10 +1,15 @@ -# "dns_alias": "= 'user.' + domain_public", { "webapp": { "modules": ["user", "billing", "help"], - "couchdb_hosts": "= nodes[:services => :couchdb].field(:fqdn)" + "couchdb_hosts": "= nodes[:services => :couchdb].field('domain.name')" }, "definition_files": { - "provider": "= file('public-definitions/provider.json.erb')" + "provider": "= file('service-definitions/provider.json.erb')", + "eip_service": "file('service-definitions/eip-service.json.erb')" + }, + "service_type": "public_service", + "api_domain": "= 'api.' + domain.public", + "dns": { + "aliases": "= [domain.public, api_domain]" } } \ No newline at end of file -- cgit v1.2.3