[CORD-2303]
Use FQDN for lookup of service endpoints

Change-Id: I73723e7855254c56b4cb8b1f472d712cc30f4926
diff --git a/roles/cord-profile/defaults/main.yml b/roles/cord-profile/defaults/main.yml
index 72c6b9b..a217af0 100644
--- a/roles/cord-profile/defaults/main.yml
+++ b/roles/cord-profile/defaults/main.yml
@@ -53,6 +53,7 @@
 
 xos_bootstrap_ui_port: 9001
 xos_ui_port: 9000
+xos_chameleon_port: 9101
 
 xos_users: []
 
@@ -126,7 +127,10 @@
 use_fabric: False
 fabric_network_cfg_json: "/opt/cord_profile/fabric-network-cfg.json"
 
-# Need to track each application's version separately
+# base URL of maven repo where ONOS apps are retrieved
+onos_mavenrepo_url: "{{ 'http://mavenrepo.' ~ site_suffix ~ ':8080' }}"
+
+# Need to track each ONOS application's version separately
 cord_config_app_version: "1.3.0"
 cord_vtn_app_version: "1.3.0"
 
diff --git a/roles/cord-profile/templates/carrierethernet-global-app.yaml.j2 b/roles/cord-profile/templates/carrierethernet-global-app.yaml.j2
index 1edd97a..f421285 100644
--- a/roles/cord-profile/templates/carrierethernet-global-app.yaml.j2
+++ b/roles/cord-profile/templates/carrierethernet-global-app.yaml.j2
@@ -22,4 +22,5 @@
               node: service#ONOS_CORD
               relationship: tosca.relationships.TenantOfService
       properties:
-          install_dependencies: http://mavenrepo:8080/repository/org/opencord/ce/ce-api/1.0.0-SNAPSHOT/ce-api-1.0.0-SNAPSHOT.oar, http://mavenrepo:8080/repository/org/opencord/ce/ecord-global-app/1.0.0-SNAPSHOT/ecord-global-app-1.0.0-SNAPSHOT.oar
+          install_dependencies: {{ onos_mavenrepo_url }}/repository/org/opencord/ce/ce-api/1.0.0-SNAPSHOT/ce-api-1.0.0-SNAPSHOT.oar, {{ onos_mavenrepo_url }}/repository/org/opencord/ce/ecord-global-app/1.0.0-SNAPSHOT/ecord-global-app-1.0.0-SNAPSHOT.oar
+
diff --git a/roles/cord-profile/templates/carrierethernet-local-app.yaml.j2 b/roles/cord-profile/templates/carrierethernet-local-app.yaml.j2
index d7fce70..6dfeee9 100644
--- a/roles/cord-profile/templates/carrierethernet-local-app.yaml.j2
+++ b/roles/cord-profile/templates/carrierethernet-local-app.yaml.j2
@@ -28,7 +28,7 @@
               node: service#ONOS_CORD
               relationship: tosca.relationships.TenantOfService
       properties:
-          install_dependencies: http://mavenrepo:8080/repository/org/opencord/ce/ce-api/1.0.0-SNAPSHOT/ce-api-1.0.0-SNAPSHOT.oar, http://mavenrepo:8080/repository/org/opencord/ce/bigswitch/1.0.0-SNAPSHOT/bigswitch-1.0.0-SNAPSHOT.oar, http://mavenrepo:8080/repository/org/opencord/ce/local-channel/1.0.0-SNAPSHOT/local-channel-1.0.0-SNAPSHOT.oar, http://mavenrepo:8080/repository/org/opencord/ce/vee/1.0.0-SNAPSHOT/vee-1.0.0-SNAPSHOT.oar
+          install_dependencies: {{ onos_mavenrepo_url }}/repository/org/opencord/ce/ce-api/1.0.0-SNAPSHOT/ce-api-1.0.0-SNAPSHOT.oar, {{ onos_mavenrepo_url }}/repository/org/opencord/ce/bigswitch/1.0.0-SNAPSHOT/bigswitch-1.0.0-SNAPSHOT.oar, {{ onos_mavenrepo_url }}/repository/org/opencord/ce/local-channel/1.0.0-SNAPSHOT/local-channel-1.0.0-SNAPSHOT.oar, {{ onos_mavenrepo_url }}//repository/org/opencord/ce/vee/1.0.0-SNAPSHOT/vee-1.0.0-SNAPSHOT.oar
           dependencies: org.onosproject.drivers.microsemi, org.onosproject.cfm
           component_config: >
               {
@@ -48,7 +48,7 @@
               node: service#ONOS_Fabric
               relationship: tosca.relationships.TenantOfService
       properties:
-          install_dependencies: http://mavenrepo:8080/repository/org/opencord/ce/ce-api/1.0.0-SNAPSHOT/ce-api-1.0.0-SNAPSHOT.oar, http://mavenrepo:8080/repository/org/opencord/ce/bigswitch/1.0.0-SNAPSHOT/bigswitch-1.0.0-SNAPSHOT.oar, http://mavenrepo:8080/repository/org/opencord/ce/local-channel/1.0.0-SNAPSHOT/local-channel-1.0.0-SNAPSHOT.oar, http://mavenrepo:8080/repository/org/opencord/ce/fabric/1.0.0-SNAPSHOT/fabric-1.0.0-SNAPSHOT.oar
+          install_dependencies: {{ onos_mavenrepo_url }}/repository/org/opencord/ce/ce-api/1.0.0-SNAPSHOT/ce-api-1.0.0-SNAPSHOT.oar, {{ onos_mavenrepo_url }}/repository/org/opencord/ce/bigswitch/1.0.0-SNAPSHOT/bigswitch-1.0.0-SNAPSHOT.oar, {{ onos_mavenrepo_url }}//repository/org/opencord/ce/local-channel/1.0.0-SNAPSHOT/local-channel-1.0.0-SNAPSHOT.oar, {{ onos_mavenrepo_url }}//repository/org/opencord/ce/fabric/1.0.0-SNAPSHOT/fabric-1.0.0-SNAPSHOT.oar
           component_config: >
               {
                   "org.opencord.ce.local.bigswitch.BigSwitchManager": {
diff --git a/roles/cord-profile/templates/fabric-service.yaml.j2 b/roles/cord-profile/templates/fabric-service.yaml.j2
index ffbc3e1..5f01466 100644
--- a/roles/cord-profile/templates/fabric-service.yaml.j2
+++ b/roles/cord-profile/templates/fabric-service.yaml.j2
@@ -33,7 +33,7 @@
           kind: onos
           view_url: /admin/onos/onosservice/$id$/
           no_container: true
-          rest_hostname: onos-fabric
+          rest_hostname: onos-fabric.{{ site_suffix }}
           replaces: service_ONOS_Fabric
           rest_onos/v1/network/configuration/: { get_artifact: [ SELF, fabric_network_cfg_json, LOCAL_FILE ] }
       artifacts:
diff --git a/roles/cord-profile/templates/onos-global-service.yaml.j2 b/roles/cord-profile/templates/onos-global-service.yaml.j2
index 44394e5..2b7d33f 100644
--- a/roles/cord-profile/templates/onos-global-service.yaml.j2
+++ b/roles/cord-profile/templates/onos-global-service.yaml.j2
@@ -33,6 +33,6 @@
           kind: onos
           view_url: /admin/onos/onosservice/$id$/
           no_container: true
-          rest_hostname: onos-cord
+          rest_hostname: onos-cord.{{ site_suffix }}
           rest_port: 8182
           replaces: service_ONOS_CORD
diff --git a/roles/cord-profile/templates/vnaasglobal-service-reference.yaml.j2 b/roles/cord-profile/templates/vnaasglobal-service-reference.yaml.j2
index d1bade7..25626a7 100644
--- a/roles/cord-profile/templates/vnaasglobal-service-reference.yaml.j2
+++ b/roles/cord-profile/templates/vnaasglobal-service-reference.yaml.j2
@@ -1,4 +1,3 @@
-
 {#
 Copyright 2017-present Open Networking Foundation
 
@@ -54,7 +53,7 @@
       requirements:
       properties:
         name: onlabT
-        onos_ip: onos-cord
+        onos_ip: onos-cord.{{ site_suffix }}
         onos_port: 8182
         onos_username: onos
         onos_password: rocks
diff --git a/roles/cord-profile/templates/vrouter.yaml.j2 b/roles/cord-profile/templates/vrouter.yaml.j2
index 588754c..82c437c 100644
--- a/roles/cord-profile/templates/vrouter.yaml.j2
+++ b/roles/cord-profile/templates/vrouter.yaml.j2
@@ -33,7 +33,7 @@
           view_url: /admin/vrouter/
           no-delete: true
           no-create: true
-          rest_hostname: onos-fabric
+          rest_hostname: onos-fabric.{{ site_suffix }}
           rest_port: 8181
           rest_user: onos
           rest_pass: rocks
diff --git a/roles/cord-profile/templates/vtn-service.yaml.j2 b/roles/cord-profile/templates/vtn-service.yaml.j2
index 8eb4c4b..eab7961 100644
--- a/roles/cord-profile/templates/vtn-service.yaml.j2
+++ b/roles/cord-profile/templates/vtn-service.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
 
 imports:
@@ -33,7 +31,7 @@
           kind: onos
           view_url: /admin/onos/onosservice/$id$/
           no_container: true
-          rest_hostname: onos-cord
+          rest_hostname: onos-cord.{{ site_suffix }}
           rest_port: 8182
           replaces: service_ONOS_CORD
 
@@ -47,12 +45,12 @@
           sshUser: root
           sshKeyFile: /root/node_key
           sshPort: 22
-          xosEndpoint: http://xos:{{ xos_ui_port }}/
+          xosEndpoint: xos-chameleon.{{ site_suffix }}:{{ xos_chameleon_port }}
           xosUser: {{ xos_admin_user }}
           xosPassword: {{ xos_admin_pass }}
           replaces: service_vtn
           vtnAPIVersion: 2
-          controllerPort: onos-cord:6654
+          controllerPort: onos-cord.{{ site_suffix }}:6654
 
     VTN_ONOS_app:
       type: tosca.nodes.ONOSVTNApp
@@ -64,7 +62,7 @@
               node: service#vtn
               relationship: tosca.relationships.UsedByService
       properties:
-          install_dependencies: http://mavenrepo:8080/repository/org/opencord/cord-config/{{ cord_config_app_version }}/cord-config-{{ cord_config_app_version }}.oar,http://mavenrepo:8080/repository/org/opencord/vtn/{{ cord_vtn_app_version }}/vtn-{{ cord_vtn_app_version }}.oar
+          install_dependencies: {{ onos_mavenrepo_url }}/repository/org/opencord/cord-config/{{ cord_config_app_version }}/cord-config-{{ cord_config_app_version }}.oar, {{ onos_mavenrepo_url }}/repository/org/opencord/vtn/{{ cord_vtn_app_version }}/vtn-{{ cord_vtn_app_version }}.oar
           dependencies: org.onosproject.drivers, org.onosproject.drivers.ovsdb, org.onosproject.openflow-base, org.onosproject.ovsdb-base, org.onosproject.dhcp
           autogenerate: vtn-network-cfg