Updates to opencloud playbook to work more like CORD
changes to work with new service-profile
reworked xos-start to have per-config settings
add to cord_single_defaults.yml too
generate TOSCA config in platform-install
moved user/deployment creation to earlier in process
add stubs for Site/Deployment
fix empty compute group case
use tosca generator for cord-pod, and supply paths to images
reorg of config variables
remove whitespace
enable copy of service-profile for testing
generate more Tosca in platform-install
more templating, whitespace
list of copied Tosca files is now a parameter
template the vtn config when onboarding new compute notes
fix ipaddr template, which was incorrectly documented
recreate nodes and vtn config when adding compute nodes
fixes for xos on head node change
more fixes for XOS on head node
more fixes for xos delayering
fixes to image loading and 'make vtn' task
use hostname rather than full fqdn in tosca
fix secondary location of nodes/vtn template
readd management_hosts_template to management-net.yaml
update opencloud bits to current, remove obsolete roles
fix UI paths, which were escaped
make diag role work with xos container not in vm, collect more docker
logs
integrate make module changes
move pauses to service-profile
dedicated openstack config
fix openstack.yaml.j2
apply changes to vtn.yaml in both places
add more head diag
fix ssl issue

Change-Id: I7526b954b3b93f121b1d329dc1e412502d194fc1
diff --git a/roles/xos-install/tasks/main.yml b/roles/xos-install/tasks/main.yml
index 7f70790..52e492a 100644
--- a/roles/xos-install/tasks/main.yml
+++ b/roles/xos-install/tasks/main.yml
@@ -27,7 +27,7 @@
       src: "{{ playbook_dir }}/../../orchestration/{{ item }}"
       dest: "{{ ansible_user_dir }}/"
   when:
-      False # orchestration.stat.exists == True   # XXX
+      orchestration.stat.exists == True
   with_items:
       - service-profile
       - xos
@@ -46,7 +46,8 @@
       - vtn
       - olt
   when:
-      False # (orchestration.stat.exists == True) and (onos_apps.stat.exists == True)   # XXX
+      (orchestration.stat.exists == True) and (onos_apps.stat.exists == True)
+
 
 # ----  alternatively, check out repos from Internet ---
 
@@ -57,7 +58,7 @@
     version={{ service_profile_repo_branch }}
     force=yes
   when:
-    True # orchestration.stat.exists == False   # XXX
+    orchestration.stat.exists == False
 
 # ----  install keys ----
 
@@ -84,13 +85,17 @@
    - id_rsa.pub
    - node_key
 
-# ----
+- name: Create templated TOSCA files
+  template:
+    src: "{{ item }}.j2"
+    dest: "{{ service_profile_repo_dest }}/{{ xos_configuration }}/{{ item }}"
+  with_items: "{{ xos_tosca_templates }}"
 
 - name: Download Glance VM images
   get_url:
     url={{ item.url }}
     checksum={{ item.checksum }}
-    dest={{ service_profile_repo_dest }}/{{ xos_configuration }}/images/{{ item.name }}.img
+    dest={{ service_profile_repo_dest }}/{{ xos_configuration }}/images/{{ item.name }}.qcow2
   with_items: "{{ xos_images }}"
 
 # ---- pull docker images ----
diff --git a/roles/xos-install/templates/cord-services.yaml.j2 b/roles/xos-install/templates/cord-services.yaml.j2
new file mode 100644
index 0000000..b182f04
--- /dev/null
+++ b/roles/xos-install/templates/cord-services.yaml.j2
@@ -0,0 +1,173 @@
+tosca_definitions_version: tosca_simple_yaml_1_0
+
+description: Just enough Tosca to get the vSG slice running on the CORD POD, created by platform-install
+
+imports:
+   - custom_types/xos.yaml
+
+topology_template:
+  node_templates:
+
+# site, image, fully created in deployment.yaml
+    {{ site_name }}:
+      type: tosca.nodes.Site
+
+    image#vsg-1.1:
+      type: tosca.nodes.Image
+
+# management networks, fully created in management-net.yaml
+    management:
+      type: tosca.nodes.network.Network.XOS
+      properties:
+        no-create: true
+        no-delete: true
+        no-update: true
+
+    management_hosts:
+      type: tosca.nodes.network.Network.XOS
+      properties:
+        no-create: true
+        no-delete: true
+        no-update: true
+
+# ONOS_CORD, fully created in vtn.yaml
+    service#ONOS_CORD:
+      type: tosca.nodes.ONOSService
+      properties:
+        no-delete: true
+        no-create: true
+        no-update: true
+
+# ONOS_Fabric, fully created in fabric.yaml
+    service#ONOS_Fabric:
+      type: tosca.nodes.ONOSService
+      properties:
+        no-delete: true
+        no-create: true
+        no-update: true
+
+# CORD Services
+    service#vtr:
+      type: tosca.nodes.Service
+      properties:
+        view_url: /admin/vtr/vtrservice/$id$/
+        kind: vTR
+        replaces: service_vtr
+
+    service#volt:
+      type: tosca.nodes.VOLTService
+      requirements:
+        - vsg_tenant:
+            node: service#vsg
+            relationship: tosca.relationships.TenantOfService
+      properties:
+        view_url: /admin/volt/voltservice/$id$/
+        kind: vOLT
+        replaces: service_volt
+        public_key: { get_artifact: [ SELF, pubkey, LOCAL_FILE] }
+        private_key_fn: /opt/xos/services/volt/keys/volt_rsa
+      artifacts:
+        pubkey: /opt/xos/services/volt/keys/volt_rsa.pub
+
+    addresses_vsg:
+      type: tosca.nodes.AddressPool
+      properties:
+        addresses: 10.6.1.128/26
+        gateway_ip: 10.6.1.129
+        gateway_mac: 02:42:0a:06:01:01
+
+    addresses_public:
+      type: tosca.nodes.AddressPool
+      properties:
+        addresses: 10.6.1.192/26
+        gateway_ip: 10.6.1.193
+        gateway_mac: 02:42:0a:06:01:01
+
+    label_vsg:
+      type: tosca.nodes.NodeLabel
+
+    service#vsg:
+      type: tosca.nodes.VSGService
+      requirements:
+        - vrouter_tenant:
+            node: service#vrouter
+            relationship: tosca.relationships.TenantOfService
+      properties:
+        view_url: /admin/vsg/vsgservice/$id$/
+        backend_network_label: hpc_client
+        public_key: { get_artifact: [ SELF, pubkey, LOCAL_FILE] }
+        private_key_fn: /opt/xos/services/vsg/keys/vsg_rsa
+#       node_label: label_vsg
+        replaces: service_vsg
+      artifacts:
+        pubkey: /opt/xos/services/vsg/keys/vsg_rsa.pub
+
+    service#vrouter:
+      type: tosca.nodes.VRouterService
+      properties:
+        view_url: /admin/vrouter/vrouterservice/$id$/
+        replaces: service_vrouter
+      requirements:
+        - addresses_vsg:
+            node: addresses_vsg
+            relationship: tosca.relationships.ProvidesAddresses
+        - addresses_public:
+            node: addresses_public
+            relationship: tosca.relationships.ProvidesAddresses
+
+    vRouter_ONOS_app:
+      type: tosca.nodes.ONOSvRouterApp
+      requirements:
+        - onos_tenant:
+            node: service#ONOS_Fabric
+            relationship: tosca.relationships.TenantOfService
+        - vrouter_service:
+            node: service#vrouter
+            relationship: tosca.relationships.UsedByService
+      properties:
+        dependencies: org.onosproject.vrouter
+        autogenerate: vrouter-network-cfg
+
+    template#vsg:
+      type: tosca.nodes.NetworkTemplate
+      properties:
+        visibility: private
+        translation: none
+        vtn_kind: VSG
+
+    # Networks required by the CORD setup
+    {{ site_name }}_vsg-access:
+      type: tosca.nodes.network.Network
+      properties:
+        ip_version: 4
+      requirements:
+        - network_template:
+            node: template#vsg
+            relationship: tosca.relationships.UsesNetworkTemplate
+        - owner:
+            node: {{ site_name }}_vsg
+            relationship: tosca.relationships.MemberOfSlice
+        - connection:
+            node: {{ site_name }}_vsg
+            relationship: tosca.relationships.ConnectsToSlice
+
+    # CORD Slices
+    {{ site_name }}_vsg:
+      description: vSG Controller Slice
+      type: tosca.nodes.Slice
+      properties:
+        network: noauto
+      requirements:
+        - vsg_service:
+            node: service#vsg
+            relationship: tosca.relationships.MemberOfService
+        - site:
+            node: {{ site_name }}
+            relationship: tosca.relationships.MemberOfSite
+        - management:
+            node: management
+            relationship: tosca.relationships.ConnectsToNetwork
+        - image:
+            node: image#vsg-1.1
+            relationship: tosca.relationships.DefaultImage
+
diff --git a/roles/xos-install/templates/cord-test-subscriber.yaml.j2 b/roles/xos-install/templates/cord-test-subscriber.yaml.j2
new file mode 100644
index 0000000..59d9cfe
--- /dev/null
+++ b/roles/xos-install/templates/cord-test-subscriber.yaml.j2
@@ -0,0 +1,121 @@
+tosca_definitions_version: tosca_simple_yaml_1_0
+
+description: Creates a CORD test subscriber, created by platform-install
+
+imports:
+   - custom_types/xos.yaml
+
+topology_template:
+  node_templates:
+
+# site, fully created in deployment.yaml
+    {{ site_name }}:
+      type: tosca.nodes.Site
+      properties:
+        no-delete: true
+        no-create: true
+        no-update: true
+
+# vsg slice, volt service, fully created in cord-services.yaml
+    {{ site_name }}_vsg:
+      type: tosca.nodes.Slice
+      properties:
+        no-delete: true
+        no-create: true
+        no-update: true
+
+    service#volt:
+      type: tosca.nodes.VOLTService
+      properties:
+        no-delete: true
+        no-create: true
+        no-update: true
+
+# Test subscriber
+
+    # Let's add a user who can be administrator of the household
+    johndoe@myhouse.com:
+      type: tosca.nodes.User
+      properties:
+        password: letmein
+        firstname: john
+        lastname: doe
+      requirements:
+        - site:
+            node: {{ site_name }}
+            relationship: tosca.relationships.MemberOfSite
+        - dependency:
+            node: {{ site_name }}_vsg
+            relationship: tosca.relationships.DependsOn
+
+    # A subscriber
+    My House:
+      type: tosca.nodes.CORDSubscriber
+      properties:
+        service_specific_id: 123
+        firewall_enable: false
+        cdn_enable: false
+        url_filter_enable: false
+        url_filter_level: R
+      requirements:
+        - house_admin:
+            node: johndoe@myhouse.com
+            relationship: tosca.relationships.AdminPrivilege
+
+    Mom's PC:
+      type: tosca.nodes.CORDUser
+      properties:
+        mac: 01:02:03:04:05:06
+        level: PG_13
+      requirements:
+        - household:
+            node: My House
+            relationship: tosca.relationships.SubscriberDevice
+
+    Dad's PC:
+      type: tosca.nodes.CORDUser
+      properties:
+        mac: 90:E2:BA:82:F9:75
+        level: PG_13
+      requirements:
+        - household:
+            node: My House
+            relationship: tosca.relationships.SubscriberDevice
+
+    Jack's Laptop:
+      type: tosca.nodes.CORDUser
+      properties:
+        mac: 68:5B:35:9D:91:D5
+        level: PG_13
+      requirements:
+        - household:
+            node: My House
+            relationship: tosca.relationships.SubscriberDevice
+
+    Jill's Laptop:
+      type: tosca.nodes.CORDUser
+      properties:
+        mac: 34:36:3B:C9:B6:A6
+        level: PG_13
+      requirements:
+        - household:
+            node: My House
+            relationship: tosca.relationships.SubscriberDevice
+
+    My Volt:
+      type: tosca.nodes.VOLTTenant
+      properties:
+        service_specific_id: 123
+        s_tag: 222
+        c_tag: 111
+      requirements:
+        - provider_service:
+            node: service#volt
+            relationship: tosca.relationships.MemberOfService
+        - subscriber:
+            node: My House
+            relationship: tosca.relationships.BelongsToSubscriber
+        - dependency:
+            node: {{ site_name }}_vsg
+            relationship: tosca.relationships.DependsOn
+
diff --git a/roles/xos-install/templates/deployment.yaml.j2 b/roles/xos-install/templates/deployment.yaml.j2
new file mode 100644
index 0000000..2d5dfd1
--- /dev/null
+++ b/roles/xos-install/templates/deployment.yaml.j2
@@ -0,0 +1,71 @@
+tosca_definitions_version: tosca_simple_yaml_1_0
+
+imports:
+   - custom_types/xos.yaml
+
+description: deployment config, generated by platform-install
+
+topology_template:
+  node_templates:
+
+# Flavors
+
+{% for flavor in deployment_flavors %}
+    {{ flavor }}:
+      type: tosca.nodes.Flavor
+
+{% endfor %}
+
+# Deployment
+    {{ deployment_type }}:
+      type: tosca.nodes.Deployment
+      requirements:
+{% for flavor in deployment_flavors %}
+          - {{ flavor }}:
+              node: {{ flavor }}
+              relationship: tosca.relationships.SupportsFlavor
+
+{% endfor %}
+
+# Site
+    {{ site_name }}:
+      type: tosca.nodes.Site
+      properties:
+          display_name: {{ site_humanname }}
+          site_url: http://{{ site_name }}.opencloud.us/
+          hosts_nodes: true
+      requirements:
+        - deployment:
+            node: {{ deployment_type }}
+            relationship: tosca.relationships.MemberOfDeployment
+
+# Attach the Tenant view to the deployment
+    Tenant:
+      type: tosca.nodes.DashboardView
+      properties:
+          no-create: true
+          no-delete: true
+      requirements:
+          - deployment:
+              node: {{ deployment_type }}
+              relationship: tosca.relationships.SupportsDeployment
+
+# XOS Users
+{% for user in xos_users %}
+    {{ user.email }}:
+      type: tosca.nodes.User
+      properties:
+        password: {{ user.password }}
+        firstname: {{ user.first | default(user.email) }}
+        lastname: {{ user.last | default("unknown") }}
+        is_admin: {{ user.admin | default("false") }}
+      requirements:
+        - site:
+            node: {{ site_name }}
+            relationship: tosca.relationships.MemberOfSite
+        - tenant_dashboard:
+              node: Tenant
+              relationship: tosca.relationships.UsesDashboard
+
+{% endfor %}
+
diff --git a/roles/xos-install/templates/exampleservice.yaml.j2 b/roles/xos-install/templates/exampleservice.yaml.j2
new file mode 100644
index 0000000..53c2173
--- /dev/null
+++ b/roles/xos-install/templates/exampleservice.yaml.j2
@@ -0,0 +1,104 @@
+tosca_definitions_version: tosca_simple_yaml_1_0
+
+description: Setup the ExampleService on the pod
+
+imports:
+   - custom_types/xos.yaml
+   - custom_types/exampleservice.yaml
+
+topology_template:
+  node_templates:
+
+# image/flavor are hardcoded - FIXME if/when they change
+    m1.small:
+      type: tosca.nodes.Flavor
+
+    trusty-server-multi-nic:
+      type: tosca.nodes.Image
+
+# private network template, created in fixtures.yml
+    Private:
+      type: tosca.nodes.NetworkTemplate
+
+# site, fully created in deployment.yaml
+    {{ site_name }}:
+      type: tosca.nodes.Site
+
+# management network, fully created in management-net.yaml
+    management:
+      type: tosca.nodes.network.Network.XOS
+      properties:
+        no-create: true
+        no-delete: true
+        no-update: true
+
+# public network, fully created in public-net.yaml
+    public:
+      type: tosca.nodes.network.Network.XOS
+      properties:
+        no-create: true
+        no-delete: true
+        no-update: true
+
+# vrouter service, fully created in cord-service.yaml
+    service#vrouter:
+      type: tosca.nodes.Service
+      properties:
+        no-create: true
+        no-delete: true
+        no-update: true
+
+# ExampleService/ExampleTenant
+
+    {{ site_name }}_exampleservice:
+      description: This slice holds the ExampleService
+      type: tosca.nodes.Slice
+      properties:
+        network: noauto
+      requirements:
+        - site:
+            node: {{ site_name }}
+            relationship: tosca.relationships.MemberOfSite
+        - management:
+            node: management
+            relationship: tosca.relationships.ConnectsToNetwork
+        - public:
+            node: public
+            relationship: tosca.relationships.ConnectsToNetwork
+        - exmapleserver:
+            node: service#exampleservice
+            relationship: tosca.relationships.MemberOfService
+        - image:
+            node: trusty-server-multi-nic
+            relationship: tosca.relationships.DefaultImage
+        - default_flavor:
+            node: m1.small
+            relationship: tosca.relationships.DefaultFlavor
+
+    service#exampleservice:
+      type: tosca.nodes.ExampleService
+      requirements:
+        - management:
+            node: management
+            relationship: tosca.relationships.UsesNetwork
+      properties:
+        view_url: /admin/exampleservice/exampleservice/$id$/
+        kind: exampleservice
+        public_key: { get_artifact: [ SELF, pubkey, LOCAL_FILE] }
+        private_key_fn: /opt/xos/services/exampleservice/keys/exampleservice_rsa
+        service_message: hello
+      artifacts:
+        pubkey: /opt/xos/services/exampleservice/keys/exampleservice_rsa.pub
+
+    tenant#exampletenant1:
+      type: tosca.nodes.ExampleTenant
+      properties:
+        tenant_message: world
+      requirements:
+        - tenant:
+            node: service#exampleservice
+            relationship: tosca.relationships.TenantOfService
+        - dependency:
+            node: {{ site_name }}_exampleservice
+            relationship: tosca.relationships.DependsOn
+
diff --git a/roles/xos-install/templates/fabric.yaml.j2 b/roles/xos-install/templates/fabric.yaml.j2
new file mode 100644
index 0000000..664505f
--- /dev/null
+++ b/roles/xos-install/templates/fabric.yaml.j2
@@ -0,0 +1,62 @@
+tosca_definitions_version: tosca_simple_yaml_1_0
+
+imports:
+   - custom_types/xos.yaml
+
+description: fabric configuration generated by platform-install
+
+
+topology_template:
+  node_templates:
+
+    service#ONOS_Fabric:
+      type: tosca.nodes.ONOSService
+      requirements:
+      properties:
+          kind: onos
+          view_url: /admin/onos/onosservice/$id$/
+          no_container: true
+          rest_hostname: onos-fabric
+          replaces: service_ONOS_Fabric
+          rest_onos/v1/network/configuration/: { get_artifact: [ SELF, fabric_network_cfg_json, LOCAL_FILE ] }
+      artifacts:
+          fabric_network_cfg_json: /root/setup/network-cfg-quickstart.json
+
+    service#fabric:
+      type: tosca.nodes.FabricService
+      properties:
+          view_url: /admin/fabric/fabricservice/$id$/
+          replaces: service_fabric
+
+    Fabric_ONOS_app:
+      type: tosca.nodes.ONOSApp
+      requirements:
+          - onos_tenant:
+              node: service#ONOS_Fabric
+              relationship: tosca.relationships.TenantOfService
+          - fabric_service:
+              node: service#fabric
+              relationship: tosca.relationships.UsedByService
+      properties:
+          dependencies: org.onosproject.drivers, org.onosproject.openflow-base, org.onosproject.netcfghostprovider, org.onosproject.netcfglinksprovider, org.onosproject.segmentrouting, org.onosproject.vrouter, org.onosproject.hostprovider
+
+{% for node in groups["compute"] %}
+    {{ node }}:
+      type: tosca.nodes.Node
+
+    # Fabric location field for node $NODE
+    {{ node }}_location_tag:
+      type: tosca.nodes.Tag
+      properties:
+          name: location
+          value: of:0000000000000001/1
+      requirements:
+          - target:
+              node: {{ node }}
+              relationship: tosca.relationships.TagsObject
+          - service:
+              node: service#ONOS_Fabric
+              relationship: tosca.relationships.MemberOfService
+
+{% endfor %}
+
diff --git a/roles/xos-install/templates/management-net.yaml.j2 b/roles/xos-install/templates/management-net.yaml.j2
new file mode 100644
index 0000000..79ea589
--- /dev/null
+++ b/roles/xos-install/templates/management-net.yaml.j2
@@ -0,0 +1,52 @@
+tosca_definitions_version: tosca_simple_yaml_1_0
+
+imports:
+   - custom_types/xos.yaml
+
+description: management network config, generated by platform-install
+
+topology_template:
+  node_templates:
+
+# site, fully created in deployment.yaml
+    {{ site_name }}:
+      type: tosca.nodes.Site
+
+# management network
+    management_template:
+      type: tosca.nodes.NetworkTemplate
+      properties:
+        visibility: private
+        translation: none
+        vtn_kind: MANAGEMENT_LOCAL
+
+    management_hosts_template:
+      type: tosca.nodes.NetworkTemplate
+      properties:
+          visibility: private
+          translation: none
+          vtn_kind: MANAGEMENT_HOST
+
+    management:
+      type: tosca.nodes.network.Network
+      properties:
+        ip_version: 4
+        cidr: {{ management_network_cidr }}
+      requirements:
+        - network_template:
+            node: management_template
+            relationship: tosca.relationships.UsesNetworkTemplate
+        - owner:
+            node: {{ site_name }}_management
+            relationship: tosca.relationships.MemberOfSlice
+
+    {{ site_name }}_management:
+      description: This slice exists solely to own the management network
+      type: tosca.nodes.Slice
+      properties:
+        network: noauto
+      requirements:
+        - site:
+            node: {{ site_name }}
+            relationship: tosca.relationships.MemberOfSite
+
diff --git a/roles/xos-install/templates/nodes.yaml.j2 b/roles/xos-install/templates/nodes.yaml.j2
new file mode 100644
index 0000000..7ba953b
--- /dev/null
+++ b/roles/xos-install/templates/nodes.yaml.j2
@@ -0,0 +1,31 @@
+tosca_definitions_version: tosca_simple_yaml_1_0
+
+imports:
+   - custom_types/xos.yaml
+
+description: list of compute nodes, created by platform-install
+
+topology_template:
+  node_templates:
+
+# Site/Deployment, fully defined in deployment.yaml
+    {{ site_name }}:
+      type: tosca.nodes.Site
+
+    {{ deployment_type }}:
+      type: tosca.nodes.Deployment
+
+# compute nodes
+{% for node in groups["compute"] %}
+    {{ hostvars[node]['ansible_hostname'] }}:
+      type: tosca.nodes.Node
+      requirements:
+        - site:
+            node: {{ site_name }}
+            relationship: tosca.relationships.MemberOfSite
+        - deployment:
+            node: {{ deployment_type }}
+            relationship: tosca.relationships.MemberOfDeployment
+
+{% endfor %}
+
diff --git a/roles/xos-install/templates/openstack.yaml.j2 b/roles/xos-install/templates/openstack.yaml.j2
new file mode 100644
index 0000000..65d2338
--- /dev/null
+++ b/roles/xos-install/templates/openstack.yaml.j2
@@ -0,0 +1,70 @@
+tosca_definitions_version: tosca_simple_yaml_1_0
+
+imports:
+   - custom_types/xos.yaml
+
+description: openstack extensions to deployment, generated by platform-install
+
+topology_template:
+  node_templates:
+
+# Images and flavors
+{% for image in xos_images %}
+    {{ image.name }}:
+      type: tosca.nodes.Image
+      properties:
+         path: /opt/xos/images/{{ image.name }}.qcow2
+         disk_format: QCOW2
+         container_format: BARE
+
+{% endfor %}
+
+{% for flavor in deployment_flavors %}
+    {{ flavor }}:
+      type: tosca.nodes.Flavor
+
+{% endfor %}
+
+# Deployment - adds images/flavors to site defined in deployment.yaml
+    {{ deployment_type }}:
+      type: tosca.nodes.Deployment
+      requirements:
+{% for flavor in deployment_flavors %}
+          - {{ flavor }}:
+              node: {{ flavor }}
+              relationship: tosca.relationships.SupportsFlavor
+{% endfor %}
+
+# OpenStack Controller
+    {{ site_name }}_{{ deployment_type }}_openstack:
+      type: tosca.nodes.Controller
+      requirements:
+        - deployment:
+            node: {{ deployment_type }}
+            relationship: tosca.relationships.ControllerDeployment
+      properties:
+          backend_type: OpenStack
+          version: Kilo
+          auth_url: { get_script_env: [ SELF, adminrc, OS_AUTH_URL, LOCAL_FILE] }
+          admin_user: { get_script_env: [ SELF, adminrc, OS_USERNAME, LOCAL_FILE] }
+          admin_password: { get_script_env: [ SELF, adminrc, OS_PASSWORD, LOCAL_FILE] }
+          admin_tenant: { get_script_env: [ SELF, adminrc, OS_TENANT_NAME, LOCAL_FILE] }
+          domain: Default
+      artifacts:
+          adminrc: /root/setup/admin-openrc.sh
+
+# Site - adds openstack controller to site defined in deployment.yaml
+    {{ site_name }}:
+      type: tosca.nodes.Site
+      properties:
+          display_name: {{ site_humanname }}
+          site_url: http://{{ site_name }}.opencloud.us/
+          hosts_nodes: true
+      requirements:
+        - deployment:
+            node: {{ deployment_type }}
+            relationship: tosca.relationships.MemberOfDeployment
+        - controller:
+            node: {{ site_name }}_{{ deployment_type }}_openstack
+            relationship: tosca.relationships.UsesController
+
diff --git a/roles/xos-install/templates/public-net.yaml.j2 b/roles/xos-install/templates/public-net.yaml.j2
new file mode 100644
index 0000000..bd12924
--- /dev/null
+++ b/roles/xos-install/templates/public-net.yaml.j2
@@ -0,0 +1,52 @@
+tosca_definitions_version: tosca_simple_yaml_1_0
+
+imports:
+   - custom_types/xos.yaml
+
+description: public network config, generated by platform-install
+
+topology_template:
+  node_templates:
+
+# site, fully created in deployment.yaml
+    {{ site_name }}:
+      type: tosca.nodes.Site
+
+# vrouter service, fully created in cord-service.yaml
+    service#vrouter:
+      type: tosca.nodes.VRouterService
+
+# public network
+    public_template:
+      type: tosca.nodes.NetworkTemplate
+      properties:
+          visibility: private
+          translation: none
+          vtn_kind: PUBLIC
+
+    public:
+      type: tosca.nodes.network.Network
+      properties:
+          ip_version: 4
+      requirements:
+          - network_template:
+              node: public_template
+              relationship: tosca.relationships.UsesNetworkTemplate
+          - owner:
+              node: {{ site_name }}_public
+              relationship: tosca.relationships.MemberOfSlice
+          - vrouter_tenant:
+              node: service#vrouter
+              relationship: tosca.relationships.TenantOfService
+
+
+    {{ site_name }}_public:
+      description: This slice exists solely to own the public network
+      type: tosca.nodes.Slice
+      properties:
+          network: noauto
+      requirements:
+          - site:
+              node: {{ site_name }}
+              relationship: tosca.relationships.MemberOfSite
+
diff --git a/roles/xos-install/templates/vtn.yaml.j2 b/roles/xos-install/templates/vtn.yaml.j2
new file mode 100644
index 0000000..498eeef
--- /dev/null
+++ b/roles/xos-install/templates/vtn.yaml.j2
@@ -0,0 +1,102 @@
+tosca_definitions_version: tosca_simple_yaml_1_0
+
+imports:
+   - custom_types/xos.yaml
+
+description: autogenerated node tags file for VTN configuration
+
+topology_template:
+  node_templates:
+
+    service#ONOS_CORD:
+      type: tosca.nodes.ONOSService
+      requirements:
+      properties:
+          kind: onos
+          view_url: /admin/onos/onosservice/$id$/
+          no_container: true
+          rest_hostname: onos-cord
+          replaces: service_ONOS_CORD
+
+    service#vtn:
+      type: tosca.nodes.VTNService
+      properties:
+          view_url: /admin/vtn/vtnservice/$id$/
+          privateGatewayMac: 00:00:00:00:00:01
+          localManagementIp: {{ management_network_ip }}
+          ovsdbPort: 6641
+          sshUser: root
+          sshKeyFile: /root/node_key
+          sshPort: 22
+          xosEndpoint: http://xos:8888/
+          xosUser: padmin@vicci.org
+          xosPassword: letmein
+          replaces: service_vtn
+          vtnAPIVersion: 2
+
+{% for node in groups["compute"] %}
+    {{ hostvars[node]['ansible_hostname'] }}:
+      type: tosca.nodes.Node
+
+    # VTN bridgeId field for node {{ hostvars[node]['ansible_hostname'] }}
+    {{ hostvars[node]['ansible_hostname'] }}_bridgeId_tag:
+      type: tosca.nodes.Tag
+      properties:
+          name: bridgeId
+          value: of:{{ "%016d" | format(loop.index) }}
+      requirements:
+          - target:
+              node: {{ hostvars[node]['ansible_hostname'] }}
+              relationship: tosca.relationships.TagsObject
+          - service:
+              node: service#ONOS_CORD
+              relationship: tosca.relationships.MemberOfService
+
+    # VTN dataPlaneIntf field for node {{ hostvars[node]['ansible_hostname'] }}
+    {{ hostvars[node]['ansible_hostname'] }}_dataPlaneIntf_tag:
+      type: tosca.nodes.Tag
+      properties:
+          name: dataPlaneIntf
+          value: fabric
+      requirements:
+          - target:
+              node: {{ hostvars[node]['ansible_hostname'] }}
+              relationship: tosca.relationships.TagsObject
+          - service:
+              node: service#ONOS_CORD
+              relationship: tosca.relationships.MemberOfService
+
+    # VTN dataPlaneIp field for node {{ hostvars[node]['ansible_hostname'] }}
+    {{ hostvars[node]['ansible_hostname'] }}_dataPlaneIp_tag:
+      type: tosca.nodes.Tag
+      properties:
+          name: dataPlaneIp
+{% if 'ipv4' in hostvars[node]['ansible_fabric'] %}
+          value: {{ ( hostvars[node]['ansible_fabric']['ipv4']['address'] ~ '/' ~ hostvars[node]['ansible_fabric']['ipv4']['netmask'] ) | ipaddr('cidr') }}
+{% else %}{# single node case #}
+          value: 10.168.0.253/24
+{% endif %}
+      requirements:
+          - target:
+              node: {{ hostvars[node]['ansible_hostname'] }}
+              relationship: tosca.relationships.TagsObject
+          - service:
+              node: service#ONOS_CORD
+              relationship: tosca.relationships.MemberOfService
+
+{% endfor %}
+
+    VTN_ONOS_app:
+      type: tosca.nodes.ONOSVTNApp
+      requirements:
+          - onos_tenant:
+              node: service#ONOS_CORD
+              relationship: tosca.relationships.TenantOfService
+          - vtn_service:
+              node: service#vtn
+              relationship: tosca.relationships.UsedByService
+      properties:
+          install_dependencies: http://mavenrepo:8080/repository/org/opencord/cord-config/1.1-SNAPSHOT/cord-config-1.1-SNAPSHOT.oar,http://mavenrepo:8080/repository/org/opencord/vtn/1.1-SNAPSHOT/vtn-1.1-SNAPSHOT.oar
+          dependencies: org.onosproject.drivers, org.onosproject.drivers.ovsdb, org.onosproject.openflow-base, org.onosproject.ovsdb-base, org.onosproject.dhcp
+          autogenerate: vtn-network-cfg
+