[CORD-1936]
Updates to ecord manifests

[CORD-1916]
Fix host_dns_check.py, thanks to Max Chu

Change-Id: I8b97b7c8a531e8c20d486989e50608e556266705
diff --git a/profile_manifests/ecord-global.yml b/profile_manifests/ecord-global.yml
index 801c7d4..3e71819 100644
--- a/profile_manifests/ecord-global.yml
+++ b/profile_manifests/ecord-global.yml
@@ -1,5 +1,4 @@
 ---
-
 # Copyright 2017-present Open Networking Foundation
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
@@ -15,13 +14,16 @@
 # limitations under the License.
 
 # profile_manifests/ecord-global.yml
-# E-CORD Profile Manifest
+# Global E-CORD Profile Manifest
+#
+# Note: supports the `single` scenario, but not the virtual/physical scenarios
+# (requires ONOS, but not MaaS/OpenStack)
 
 # Site configuration
-site_name: mysite
-site_humanname: MySite
-site_suffix: "cord.lab"
-deployment_type: MyDeployment
+site_name: ecordglobal
+site_humanname: "Global E-CORD"
+site_suffix: "{{ site_name }}.cord.lab"
+deployment_type: "global_ecord"
 
 # Feature toggles
 use_maas: True
@@ -40,11 +42,16 @@
  - fabric-network-cfg.json
 
 # GUI Config [new GUI]
-gui_project_name: "E-CORD"
+gui_project_name: "Global E-CORD"
 gui_background: "cord-bg.jpg" # TODO find ecord image
-gui_payoff: "Your Enterprise VNF orchestrator"
+gui_payoff: "Your Enterprise Global VNF orchestrator"
 
-enabled_gui_extensions: []
+enabled_gui_extensions:
+  - name: vnaas
+    path: orchestration/xos_services/vnaas/xos/gui
+    extra_files:
+      - app/style/style.css
+      - mapconstants.js
 
 # paths defined in manifest/default.xml
 xos_services:
@@ -59,237 +66,7 @@
   - name: metro-net
     path: orchestration/xos_services/metro-net
 
-# SSL server certificate generation
-server_certs:
-  - cn: "keystone.{{ site_suffix }}"
-    subj: "/C=US/ST=California/L=Menlo Park/O=ON.Lab/OU=Test Deployment/CN=keystone.{{ site_suffix }}"
-    altnames:
-      - "DNS:keystone.{{ site_suffix }}"
-      - "DNS:keystone"
-  - cn: "xos-core.{{ site_suffix }}"
-    subj: "/C=US/ST=California/L=Menlo Park/O=ON.Lab/OU=Test Deployment/CN=xos-core.{{ site_suffix }}"
-    altnames:
-      - "DNS:xos-core.{{ site_suffix }}"
-
-# Network/DNS settings
-dns_search:
-  - "{{ site_suffix }}"
-
-mgmt_ipv4_first_octets: "192.168.200"
-
-dns_servers:
-  - "{{ mgmt_ipv4_first_octets }}.1"
-
-# DNS settings for NSD/Unbound
-nsd_zones:
-  - name: "{{ site_suffix }}"
-    ipv4_first_octets: "{{ mgmt_ipv4_first_octets }}"
-    name_reverse_unbound: "168.192.in-addr.arpa"
-    soa: ns1
-    ns:
-      - { name: ns1 }
-    nodelists:
-      - head_lxd_list
-    aliases:
-      - { name: "apt-cache", dest: "head1" }
-      - { name: "cordloghost", dest: "head1" }
-      - { name: "docker", dest: "head1" }
-      - { name: "ns", dest: "head1" }
-      - { name: "ns1", dest: "head1" }
-      - { name: "onos-cord", dest: "head1" }
-      - { name: "xos", dest: "head1" }
-      - { name: "xos-chameleon", dest: "head1" }
-      - { name: "xos-rest-gw", dest: "head1" }
-      - { name: "xos-spa-gui", dest: "head1" }
-
-unbound_listen_all: True
-
-unbound_interfaces:
-  - "{{ mgmt_ipv4_first_octets }}.1/24"
-
 # VTN network configuration
-management_network_cidr: 172.27.0.0/24
 management_network_ip: 172.27.0.1/24
 data_plane_ip: 10.168.0.253/24
 
-# Juju config
-charm_versions:
-  ceilometer: "cs:trusty/ceilometer-17"
-  ceilometer-agent: "cs:trusty/ceilometer-agent-13"
-  glance: "cs:trusty/glance-28"
-  keystone: "cs:trusty/keystone-267"
-  mongodb: "cs:trusty/mongodb-33"
-  percona-cluster: "cs:trusty/percona-cluster-31"
-  nagios: "cs:trusty/nagios-10"
-  neutron-api: "cs:~cordteam/trusty/neutron-api-6"
-  nova-cloud-controller: "cs:trusty/nova-cloud-controller-64"
-  nova-compute: "cs:~cordteam/trusty/nova-compute-3"
-  nrpe: "cs:trusty/nrpe-4"
-  ntp: "cs:trusty/ntp-14"
-  openstack-dashboard: "cs:trusty/openstack-dashboard-19"
-  rabbitmq-server: "cs:trusty/rabbitmq-server-42"
-
-
-head_lxd_list:
-  - name: "juju-1"
-    service: "juju"
-    aliases:
-      - "juju"
-    ipv4_last_octet: 10
-
-  - name: "ceilometer-1"
-    service: "ceilometer"
-    aliases:
-      - "ceilometer"
-    ipv4_last_octet: 20
-    forwarded_ports:
-      - { ext: 8777, int: 8777 }
-
-  - name: "glance-1"
-    service: "glance"
-    aliases:
-      - "glance"
-    ipv4_last_octet: 30
-    forwarded_ports:
-      - { ext: 9292, int: 9292 }
-
-  - name: "keystone-1"
-    service: "keystone"
-    aliases:
-      - "keystone"
-    ipv4_last_octet: 40
-    forwarded_ports:
-      - { ext: 35357, int: 35357 }
-      - { ext: 4990, int: 4990 }
-      - { ext: 5000, int: 5000 }
-
-  - name: "percona-cluster-1"
-    service: "percona-cluster"
-    aliases:
-      - "percona-cluster"
-    ipv4_last_octet: 50
-
-  - name: "nagios-1"
-    service: "nagios"
-    aliases:
-      - "nagios"
-    ipv4_last_octet: 60
-    forwarded_ports:
-      - { ext: 3128, int: 80 }
-
-  - name: "neutron-api-1"
-    service: "neutron-api"
-    aliases:
-      - "neutron-api"
-    ipv4_last_octet: 70
-    forwarded_ports:
-      - { ext: 9696, int: 9696 }
-
-  - name: "nova-cloud-controller-1"
-    service: "nova-cloud-controller"
-    aliases:
-      - "nova-cloud-controller"
-    ipv4_last_octet: 80
-    forwarded_ports:
-      - { ext: 8774, int: 8774 }
-
-  - name: "openstack-dashboard-1"
-    service: "openstack-dashboard"
-    aliases:
-      - "openstack-dashboard"
-    ipv4_last_octet: 90
-    forwarded_ports:
-      - { ext: 8080, int: 80 }
-
-  - name: "rabbitmq-server-1"
-    service: "rabbitmq-server"
-    aliases:
-      - "rabbitmq-server"
-    ipv4_last_octet: 100
-
-  - name: "mongodb-1"
-    service: "mongodb"
-    aliases:
-      - "mongodb"
-    ipv4_last_octet: 110
-
-lxd_service_list:
-  - ceilometer
-  - glance
-  - keystone
-  - mongodb
-  - nagios
-  - neutron-api
-  - nova-cloud-controller
-  - openstack-dashboard
-  - percona-cluster
-  - rabbitmq-server
-
-
-standalone_service_list:
-  - ntp
-  - nrpe
-  - ceilometer-agent
-
-
-service_relations:
-  - name: keystone
-    relations: [ "percona-cluster", "nrpe", ]
-
-  - name: nova-cloud-controller
-    relations: [ "percona-cluster", "rabbitmq-server", "glance", "keystone", "nrpe", ]
-
-  - name: glance
-    relations: [ "percona-cluster", "keystone", "nrpe", ]
-
-  - name: neutron-api
-    relations: [ "keystone",  "percona-cluster", "rabbitmq-server", "nova-cloud-controller", "nrpe", ]
-
-  - name: openstack-dashboard
-    relations: [ "keystone", "nrpe", ]
-
-  - name: nagios
-    relations: [ "nrpe", ]
-
-  - name: "percona-cluster:juju-info"
-    relations: [ "nrpe:general-info", ]
-
-  - name: rabbitmq-server
-    relations: [ "nrpe", ]
-
-  - name: ceilometer
-    relations: [ "mongodb", "rabbitmq-server", "nagios", "nrpe", ]
-
-  - name: "ceilometer:identity-service"
-    relations: [ "keystone:identity-service", ]
-
-  - name: "ceilometer:ceilometer-service"
-    relations: [ "ceilometer-agent:ceilometer-service", ]
-
-
-compute_relations:
-  - name: nova-compute
-    relations: [ "ceilometer-agent", "glance", "nova-cloud-controller", "nagios", "nrpe", ]
-
-  - name: "nova-compute:shared-db"
-    relations: [ "percona-cluster:shared-db", ]
-
-  - name: "nova-compute:amqp"
-    relations: [ "rabbitmq-server:amqp", ]
-
-  - name: ntp
-    relations: [ "nova-compute", ]
-
-
-xos_images:
-  - name: "trusty-server-multi-nic"
-    url: "http://www.vicci.org/opencloud/trusty-server-cloudimg-amd64-disk1.img.20170201"
-    checksum: "sha256:ebf007ba3ec1043b7cd011fc6668e2a1d1d4c69c41071e8513ab355df7a057cb"
-
-  - name: "ceilometer-trusty-server-multi-nic"
-    url: "http://www.vicci.org/cord/ceilometer-trusty-server-multi-nic.compressed.qcow2"
-    checksum: "sha256:b77ef8d692b640568dea13df99fe1dfcb1f4bb4ac05408db9ff77399b34f754f"
-
-  - name: "ceilometer-service-trusty-server-multi-nic"
-    url: "http://www.vicci.org/cord/ceilometer-service-trusty-server-multi-nic.compressed.qcow2.20170131"
-    checksum: "sha256:f0341e283f0f2cb8f70cd1a6347e0081c9c8492ef34eb6397c657ef824800d4f"
diff --git a/profile_manifests/ecord.yml b/profile_manifests/ecord.yml
index 281736c..05d7bc7 100644
--- a/profile_manifests/ecord.yml
+++ b/profile_manifests/ecord.yml
@@ -1,5 +1,4 @@
 ---
-
 # Copyright 2017-present Open Networking Foundation
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
@@ -20,12 +19,14 @@
 # Site configuration
 site_name: mysite
 site_humanname: MySite
-site_suffix: "{{ site_name }}.opencord.org"
+#site_suffix: "{{ site_name }}.cord.lab" - broken, see CORD-1520
+site_suffix: "cord.lab"
 deployment_type: MyDeployment
 
 # Feature toggles
-use_maas: True
 use_apt_cache: True
+use_fabric: True
+use_maas: True
 
 # XOS config
 xos_tosca_config_templates:
@@ -50,6 +51,8 @@
 
 # paths defined in manifest/default.xml
 xos_services:
+  - name: addressmanager
+    path: orchestration/xos_services/addressmanager
   - name: openstack
     path: orchestration/xos_services/openstack
   - name: onos
@@ -64,71 +67,10 @@
   - name: veg
     path: orchestration/xos_services/vEG
     keypair: veg_rsa
-  - name: vnodlocal
-    path: orchestration/xos_services/metronet-local
   - name: vee
     path: orchestration/xos_services/vEE
 
-# SSL server certificate generation
-server_certs:
-  - cn: "keystone.{{ site_suffix }}"
-    subj: "/C=US/ST=California/L=Menlo Park/O=ON.Lab/OU=Test Deployment/CN=keystone.{{ site_suffix }}"
-    altnames:
-      - "DNS:keystone.{{ site_suffix }}"
-      - "DNS:keystone"
-  - cn: "xos-core.{{ site_suffix }}"
-    subj: "/C=US/ST=California/L=Menlo Park/O=ON.Lab/OU=Test Deployment/CN=xos-core.{{ site_suffix }}"
-    altnames:
-      - "DNS:xos-core.{{ site_suffix }}"
-
-# Network/DNS settings
-headnode: head1
-
-dns_search:
-  - "{{ site_suffix }}"
-
-mgmt_ipv4_first_octets: "192.168.200"
-
-dns_servers:
-  - "{{ mgmt_ipv4_first_octets }}.1"
-
-# DNS settings for NSD/Unbound
-nsd_zones:
-  - name: "{{ site_suffix }}"
-    ipv4_first_octets: "{{ mgmt_ipv4_first_octets }}"
-    name_reverse_unbound: "168.192.in-addr.arpa"
-    soa: ns1
-    ns:
-      - { name: ns1 }
-    nodelists:
-      - head_lxd_list
-      - physical_node_list
-    aliases:
-      - { name: "apt-cache", dest: "{{ headnode }}" }
-      - { name: "cordloghost", dest: "{{ headnode }}" }
-      - { name: "docker", dest: "{{ headnode }}" }
-      - { name: "ns", dest: "{{ headnode }}" }
-      - { name: "ns1", dest: "{{ headnode }}" }
-      - { name: "onos-cord", dest: "{{ headnode }}" }
-      - { name: "xos", dest: "{{ headnode }}" }
-      - { name: "xos-chameleon", dest: "{{ headnode }}" }
-      - { name: "xos-rest-gw", dest: "{{ headnode }}" }
-      - { name: "xos-gui", dest: "{{ headnode }}" }
-
-unbound_listen_all: True
-
-unbound_interfaces:
-  - "{{ mgmt_ipv4_first_octets }}.1/24"
-
-
-physical_node_list:
-  - name: head1
-    ipv4_last_octet: 1
-    aliases:
-      - head
-
 # VTN network configuration
-management_network_cidr: 172.27.0.0/24
 management_network_ip: 172.27.0.1/24
 data_plane_ip: 10.168.0.253/24
 
@@ -139,7 +81,6 @@
   glance: "cs:trusty/glance-28"
   keystone: "cs:trusty/keystone-267"
   mongodb: "cs:trusty/mongodb-33"
-  percona-cluster: "cs:trusty/percona-cluster-31"
   nagios: "cs:trusty/nagios-10"
   neutron-api: "cs:~cordteam/trusty/neutron-api-6"
   nova-cloud-controller: "cs:trusty/nova-cloud-controller-64"
@@ -147,6 +88,7 @@
   nrpe: "cs:trusty/nrpe-4"
   ntp: "cs:trusty/ntp-14"
   openstack-dashboard: "cs:trusty/openstack-dashboard-19"
+  percona-cluster: "cs:trusty/percona-cluster-31"
   rabbitmq-server: "cs:trusty/rabbitmq-server-42"
 
 head_lxd_list:
diff --git a/roles/cord-profile/templates/ecord-services.yaml.j2 b/roles/cord-profile/templates/ecord-services.yaml.j2
index 9362aed..03c4207 100644
--- a/roles/cord-profile/templates/ecord-services.yaml.j2
+++ b/roles/cord-profile/templates/ecord-services.yaml.j2
@@ -1,4 +1,3 @@
-
 {#
 Copyright 2017-present Open Networking Foundation
 
@@ -15,7 +14,6 @@
 limitations under the License.
 #}
 
-
 tosca_definitions_version: tosca_simple_yaml_1_0
 
 description: Just enough Tosca to get the vEG slice running on the CORD POD, created by platform-install
@@ -23,7 +21,7 @@
 imports:
    - custom_types/xos.yaml
    - custom_types/veg.yaml
-   - custom_types/vnodlocal.yaml
+   - custom_types/addressmanager.yaml
 
 topology_template:
   node_templates:
@@ -83,6 +81,16 @@
         gateway_ip: 10.8.1.1
         gateway_mac: a4:23:05:06:01:01
 
+    service#addressmanager:
+      type: tosca.nodes.AddressManagerService
+      requirements:
+        - addresses_veg:
+            node: addresses_veg
+            relationship: tosca.relationships.ProvidesAddresses
+        - addresses_public:
+            node: addresses_public
+            relationship: tosca.relationships.ProvidesAddresses
+
     label_veg:
       type: tosca.nodes.NodeLabel
 
@@ -125,7 +133,7 @@
             node: service#vrouter
             relationship: tosca.relationships.UsedByService
       properties:
-        dependencies: org.onosproject.vrouter
+        dependencies: org.onosproject.fpm
         autogenerate: vrouter-network-cfg
 
     template#veg:
@@ -135,11 +143,6 @@
         translation: none
         vtn_kind: VEG
 
-    service#vnodlocal:
-      type: tosca.nodes.VNodLocalService
-      properties:
-      requirements:
-
     # Networks required by the CORD setup
     {{ site_name }}_veg-access:
       type: tosca.nodes.network.Network
@@ -181,3 +184,53 @@
             node: image#vsg-1.1
             relationship: tosca.relationships.DefaultImage
 
+    in#lanside:
+      type: tosca.nodes.InterfaceType
+      properties:
+         direction: in
+
+    out#lanside:
+      type: tosca.nodes.InterfaceType
+      properties:
+         direction: out
+
+    in#wanside:
+      type: tosca.nodes.InterfaceType
+      properties:
+         direction: in
+
+    out#wanside:
+      type: tosca.nodes.InterfaceType
+      properties:
+         direction: out
+
+    veg_lanside:
+      type: tosca.nodes.ServiceInterface
+      requirements:
+        - service:
+            node: service#veg
+            relationship: tosca.relationships.MemberOfService
+        - interface:
+            node: in#lanside
+            relationship: tosca.relationships.IsType
+
+    veg_wanside:
+      type: tosca.nodes.ServiceInterface
+      requirements:
+        - service:
+            node: service#veg
+            relationship: tosca.relationships.MemberOfService
+        - interface:
+            node: out#wanside
+            relationship: tosca.relationships.IsType
+
+    addressmanager_wanside:
+      type: tosca.nodes.ServiceInterface
+      requirements:
+        - service:
+            node: service#addressmanager
+            relationship: tosca.relationships.MemberOfService
+        - interface:
+            node: in#wanside
+            relationship: tosca.relationships.IsType
+
diff --git a/roles/cord-profile/templates/vee-service.yaml.j2 b/roles/cord-profile/templates/vee-service.yaml.j2
index 7a113c4..5b4f49f 100644
--- a/roles/cord-profile/templates/vee-service.yaml.j2
+++ b/roles/cord-profile/templates/vee-service.yaml.j2
@@ -22,7 +22,6 @@
    - custom_types/xos.yaml
    - custom_types/vee.yaml
    - custom_types/veg.yaml
-   - custom_types/vnodlocal.yaml
 
 description: vee services, generated by platform-install
 
@@ -46,23 +45,12 @@
       artifacts:
         pubkey: /opt/xos/services/veg/keys/veg_rsa.pub
 
-    service#vnodlocal:
-      type: tosca.nodes.VNodLocalService
-      properties:
-        no-delete: true
-        no-create: true
-        no-update: true
-      requirements:
-
     service#vee:
       type: tosca.nodes.VEEService
       requirements:
           - veg_tenant:
               node: service#veg
               relationship: tosca.relationships.TenantOfService
-          - vnodlocal_tenant:
-              node: service#vnodlocal
-              relationship: tosca.relationships.TenantOfService
       properties:
         view_url: /admin/vEE/veeservice/$id$/
 
diff --git a/roles/create-lxd/library/host_dns_check.py b/roles/create-lxd/library/host_dns_check.py
index c8b3e17..2dc267e 100755
--- a/roles/create-lxd/library/host_dns_check.py
+++ b/roles/create-lxd/library/host_dns_check.py
@@ -89,5 +89,6 @@
 # Output the results
 print json.dumps(result)
 
-if result["failed"]:
+if 'failed' in result:
     sys.exit(1)
+
diff --git a/roles/test-ecord-subscriber-config/templates/test-ecord-subscriber.yaml.j2 b/roles/test-ecord-subscriber-config/templates/test-ecord-subscriber.yaml.j2
index f7eb1ed..a5c9aeb 100644
--- a/roles/test-ecord-subscriber-config/templates/test-ecord-subscriber.yaml.j2
+++ b/roles/test-ecord-subscriber-config/templates/test-ecord-subscriber.yaml.j2
@@ -1,4 +1,3 @@
-
 {#
 Copyright 2017-present Open Networking Foundation
 
@@ -15,7 +14,6 @@
 limitations under the License.
 #}
 
-
 tosca_definitions_version: tosca_simple_yaml_1_0
 
 description: Creates a CORD test subscriber, created by platform-install
@@ -24,7 +22,6 @@
    - custom_types/xos.yaml
    - custom_types/vee.yaml
    - custom_types/veg.yaml
-   - custom_types/vnodlocal.yaml
 
 topology_template:
   node_templates:
@@ -66,14 +63,6 @@
         no-create: true
         no-update: true
 
-    service#vnodlocal:
-      type: tosca.nodes.VNodLocalService
-      properties:
-        no-delete: true
-        no-create: true
-        no-update: true
-      requirements:
-
 # Test subscriber
 
     # Let's add a user who can be administrator of the household
@@ -117,13 +106,9 @@
         - provider_service:
             node: service#veg
             relationship: tosca.relationships.MemberOfService
-            node: service#vnodlocal
-            relationship: tosca.relationships.MemberOfService
         - subscriber_tenant:
             node: service#vee
             relationship: tosca.relationships.BelongsToTenant
-            node: service#vnodlocal
-            relationship: tosca.relationships.BelongsToTenant
         - subscriber:
             node: My Enterprise
             relationship: tosca.relationships.BelongsToSubscriber