merged mcord + UI + flavor
diff --git a/xos/configurations/mcord/Makefile b/xos/configurations/mcord/Makefile
index 9be6f10..30fced6 100644
--- a/xos/configurations/mcord/Makefile
+++ b/xos/configurations/mcord/Makefile
@@ -7,6 +7,7 @@
sudo docker-compose run xos python /opt/xos/tosca/run.py padmin@vicci.org /root/setup/nodes.yaml
sudo docker-compose run xos python /opt/xos/tosca/run.py padmin@vicci.org /root/setup/images.yaml
sudo docker-compose run xos python /opt/xos/tosca/run.py padmin@vicci.org /root/setup/mgmt-net.yaml
+ sudo docker-compose run xos python /opt/xos/tosca/run.py padmin@vicci.org /root/setup/mcord.yaml
sudo docker exec mcord_xos_1 cp /opt/xos/configurations/mcord/xos_mcord_config /opt/xos/xos_configuration/
sudo docker exec mcord_xos_1 touch /opt/xos/xos/settings.py
diff --git a/xos/configurations/mcord/setup.yaml b/xos/configurations/mcord/setup.yaml
index e37c4e5..e3ea5e4 100644
--- a/xos/configurations/mcord/setup.yaml
+++ b/xos/configurations/mcord/setup.yaml
@@ -14,8 +14,8 @@
properties:
flavors: m1.large, m1.medium, m1.small
-# m1.xlarge:
-# type: tosca.nodes.Flavor
+ m1.xlarge:
+ type: tosca.nodes.Flavor
MyOpenStack:
diff --git a/xos/tosca/custom_types/xos.m4 b/xos/tosca/custom_types/xos.m4
index 99448ad..7be82c5 100644
--- a/xos/tosca/custom_types/xos.m4
+++ b/xos/tosca/custom_types/xos.m4
@@ -130,6 +130,9 @@
no_container:
type: boolean
default: false
+ node_key:
+ type: string
+ required: false
tosca.nodes.ONOSApp:
@@ -205,9 +208,9 @@
type: string
required: false
- tosca.nodes.VCPEService:
+ tosca.nodes.VSGService:
description: >
- CORD: The vCPE Service.
+ CORD: The vSG Service.
derived_from: tosca.nodes.Root
capabilities:
xos_base_service_caps
@@ -475,74 +478,75 @@
# tosca definitions tosca.nodes.network.Network here rather than
# using derived_from.
derived_from: tosca.nodes.Root
- description: >
- This is a variant of the TOSCA Network object that includes additional
- XOS-specific properties.
- properties:
- ip_version:
- type: integer
- required: no
- default: 4
- constraints:
- - valid_values: [ 4, 6 ]
- description: >
- The IP version of the requested network. Valid values are 4 for ipv4
- or 6 for ipv6.
- cidr:
- type: string
- required: no
- description: >
- The cidr block of the requested network.
- start_ip:
- type: string
- required: no
- description: >
- The IP address to be used as the start of a pool of addresses within
- the full IP range derived from the cidr block.
- end_ip:
- type: string
- required: no
- description: >
- The IP address to be used as the end of a pool of addresses within
- the full IP range derived from the cidr block.
- gateway_ip:
- type: string
- required: no
- description: >
- The gateway IP address.
- network_name:
- type: string
- required: no
- description: >
- An identifier that represents an existing Network instance in the
- underlying cloud infrastructure or can be used as the name of the
- newly created network. If network_name is provided and no other
- properties are provided (with exception of network_id), then an
- existing network instance will be used. If network_name is provided
- alongside with more properties then a new network with this name will
- be created.
- network_id:
- type: string
- required: no
- description: >
- An identifier that represents an existing Network instance in the
- underlying cloud infrastructure. This property is mutually exclusive
- with all other properties except network_name. This can be used alone
- or together with network_name to identify an existing network.
- segmentation_id:
- type: string
- required: no
- description: >
- A segmentation identifier in the underlying cloud infrastructure.
- E.g. VLAN ID, GRE tunnel ID, etc..
- dhcp_enabled:
- type: boolean
- required: no
- default: true
- description: >
- Indicates should DHCP service be enabled on the network or not.
- # XOS-specific
- ports:
+ description: >
+ This is a variant of the TOSCA Network object that includes additional
+ XOS-specific properties.
+ properties:
+ xos_base_props
+ ip_version:
+ type: integer
+ required: no
+ default: 4
+ constraints:
+ - valid_values: [ 4, 6 ]
+ description: >
+ The IP version of the requested network. Valid values are 4 for ipv4
+ or 6 for ipv6.
+ cidr:
+ type: string
+ required: no
+ description: >
+ The cidr block of the requested network.
+ start_ip:
+ type: string
+ required: no
+ description: >
+ The IP address to be used as the start of a pool of addresses within
+ the full IP range derived from the cidr block.
+ end_ip:
+ type: string
+ required: no
+ description: >
+ The IP address to be used as the end of a pool of addresses within
+ the full IP range derived from the cidr block.
+ gateway_ip:
+ type: string
+ required: no
+ description: >
+ The gateway IP address.
+ network_name:
+ type: string
+ required: no
+ description: >
+ An identifier that represents an existing Network instance in the
+ underlying cloud infrastructure or can be used as the name of the
+ newly created network. If network_name is provided and no other
+ properties are provided (with exception of network_id), then an
+ existing network instance will be used. If network_name is provided
+ alongside with more properties then a new network with this name will
+ be created.
+ network_id:
+ type: string
+ required: no
+ description: >
+ An identifier that represents an existing Network instance in the
+ underlying cloud infrastructure. This property is mutually exclusive
+ with all other properties except network_name. This can be used alone
+ or together with network_name to identify an existing network.
+ segmentation_id:
+ type: string
+ required: no
+ description: >
+ A segmentation identifier in the underlying cloud infrastructure.
+ E.g. VLAN ID, GRE tunnel ID, etc..
+ dhcp_enabled:
+ type: boolean
+ required: no
+ default: true
+ description: >
+ Indicates should DHCP service be enabled on the network or not.
+ # XOS-specific
+ ports:
type: string
required: false
description: >
@@ -559,7 +563,7 @@
default: true
description: If True, then any slice may be attached to this network.
capabilities:
- link:
+ link:
type: tosca.capabilities.network.Linkable
tosca.nodes.Deployment:
@@ -744,6 +748,14 @@
type: string
required: false
description: default isolation to use when bringing up instances (default to 'vm')
+ network:
+ type: string
+ required: false
+ description: type of networking to use for this slice
+ exposed_ports:
+ type: string
+ required: false
+ description: comma-separated list of protocol _space_ port that represent ports the slice should expose
default_flavor:
# Note: we should probably formally introduce flavors to Tosca
# at some point, and use a requirement/relationship instead of
@@ -755,14 +767,6 @@
type: string
required: false
description: default node to use for this slice
- network:
- type: string
- required: false
- description: type of networking to use for this slice
- exposed_ports:
- type: string
- required: false
- description: comma-separated list of protocol _space_ port that represent ports the slice should expose
tosca.nodes.Node:
derived_from: tosca.nodes.Root
@@ -785,6 +789,20 @@
node:
type: tosca.capabilities.xos.NodeLabel
+ tosca.nodes.Flavor:
+ derived_from: tosca.nodes.Root
+ description: >
+ An XOS Flavor.
+ properties:
+ xos_base_props
+ flavor:
+ type: string
+ required: false
+ description: openstack flavor name
+ capabilities:
+ flavor:
+ type: tosca.capabilities.xos.Flavor
+
tosca.nodes.DashboardView:
derived_from: tosca.nodes.Root
description: >
@@ -923,6 +941,14 @@
derived_from: tosca.relationships.Root
valid_target_types: [ tosca.capabilities.xos.NodeLabel ]
+ tosca.relationships.SupportsFlavor:
+ derived_from: tosca.relationships.Root
+ valid_target_types: [ tosca.capabilities.xos.Flavor ]
+
+ tosca.relationships.DefaultFlavor:
+ derived_from: tosca.relationships.Root
+ valid_target_types: [ tosca.capabilities.xos.Flavor ]
+
tosca.relationships.ProvidesAddresses:
derived_from: tosca.relationships.Root
valid_target_types: [ tosca.capabilities.xos.AddressPool ]
@@ -978,6 +1004,10 @@
derived_from: tosca.capabilities.Root
description: An XOS NodeLabel
+ tosca.capabilities.xos.Flavor:
+ derived_from: tosca.capabilities.Root
+ description: An XOS Flavor
+
tosca.capabilities.xos.Image:
derived_from: tosca.capabilities.Root
description: An XOS Image
diff --git a/xos/tosca/custom_types/xos.yaml b/xos/tosca/custom_types/xos.yaml
index 1fa070b..4f546f9 100644
--- a/xos/tosca/custom_types/xos.yaml
+++ b/xos/tosca/custom_types/xos.yaml
@@ -160,6 +160,9 @@
no_container:
type: boolean
default: false
+ node_key:
+ type: string
+ required: false
tosca.nodes.ONOSApp:
@@ -263,9 +266,9 @@
type: string
required: false
- tosca.nodes.VCPEService:
+ tosca.nodes.VSGService:
description: >
- CORD: The vCPE Service.
+ CORD: The vSG Service.
derived_from: tosca.nodes.Root
capabilities:
scalable:
@@ -820,74 +823,86 @@
# tosca definitions tosca.nodes.network.Network here rather than
# using derived_from.
derived_from: tosca.nodes.Root
- description: >
- This is a variant of the TOSCA Network object that includes additional
- XOS-specific properties.
- properties:
- ip_version:
- type: integer
- required: no
- default: 4
- constraints:
- - valid_values: [ 4, 6 ]
- description: >
- The IP version of the requested network. Valid values are 4 for ipv4
- or 6 for ipv6.
- cidr:
- type: string
- required: no
- description: >
- The cidr block of the requested network.
- start_ip:
- type: string
- required: no
- description: >
- The IP address to be used as the start of a pool of addresses within
- the full IP range derived from the cidr block.
- end_ip:
- type: string
- required: no
- description: >
- The IP address to be used as the end of a pool of addresses within
- the full IP range derived from the cidr block.
- gateway_ip:
- type: string
- required: no
- description: >
- The gateway IP address.
- network_name:
- type: string
- required: no
- description: >
- An identifier that represents an existing Network instance in the
- underlying cloud infrastructure or can be used as the name of the
- newly created network. If network_name is provided and no other
- properties are provided (with exception of network_id), then an
- existing network instance will be used. If network_name is provided
- alongside with more properties then a new network with this name will
- be created.
- network_id:
- type: string
- required: no
- description: >
- An identifier that represents an existing Network instance in the
- underlying cloud infrastructure. This property is mutually exclusive
- with all other properties except network_name. This can be used alone
- or together with network_name to identify an existing network.
- segmentation_id:
- type: string
- required: no
- description: >
- A segmentation identifier in the underlying cloud infrastructure.
- E.g. VLAN ID, GRE tunnel ID, etc..
- dhcp_enabled:
- type: boolean
- required: no
- default: true
- description: >
- Indicates should DHCP service be enabled on the network or not.
- # XOS-specific
- ports:
+ description: >
+ This is a variant of the TOSCA Network object that includes additional
+ XOS-specific properties.
+ properties:
+ no-delete:
+ type: boolean
+ default: false
+ description: Do not allow Tosca to delete this object
+ no-create:
+ type: boolean
+ default: false
+ description: Do not allow Tosca to create this object
+ no-update:
+ type: boolean
+ default: false
+ description: Do not allow Tosca to update this object
+ ip_version:
+ type: integer
+ required: no
+ default: 4
+ constraints:
+ - valid_values: [ 4, 6 ]
+ description: >
+ The IP version of the requested network. Valid values are 4 for ipv4
+ or 6 for ipv6.
+ cidr:
+ type: string
+ required: no
+ description: >
+ The cidr block of the requested network.
+ start_ip:
+ type: string
+ required: no
+ description: >
+ The IP address to be used as the start of a pool of addresses within
+ the full IP range derived from the cidr block.
+ end_ip:
+ type: string
+ required: no
+ description: >
+ The IP address to be used as the end of a pool of addresses within
+ the full IP range derived from the cidr block.
+ gateway_ip:
+ type: string
+ required: no
+ description: >
+ The gateway IP address.
+ network_name:
+ type: string
+ required: no
+ description: >
+ An identifier that represents an existing Network instance in the
+ underlying cloud infrastructure or can be used as the name of the
+ newly created network. If network_name is provided and no other
+ properties are provided (with exception of network_id), then an
+ existing network instance will be used. If network_name is provided
+ alongside with more properties then a new network with this name will
+ be created.
+ network_id:
+ type: string
+ required: no
+ description: >
+ An identifier that represents an existing Network instance in the
+ underlying cloud infrastructure. This property is mutually exclusive
+ with all other properties except network_name. This can be used alone
+ or together with network_name to identify an existing network.
+ segmentation_id:
+ type: string
+ required: no
+ description: >
+ A segmentation identifier in the underlying cloud infrastructure.
+ E.g. VLAN ID, GRE tunnel ID, etc..
+ dhcp_enabled:
+ type: boolean
+ required: no
+ default: true
+ description: >
+ Indicates should DHCP service be enabled on the network or not.
+ # XOS-specific
+ ports:
type: string
required: false
description: >
@@ -904,7 +919,7 @@
default: true
description: If True, then any slice may be attached to this network.
capabilities:
- link:
+ link:
type: tosca.capabilities.network.Linkable
tosca.nodes.Deployment:
@@ -1144,6 +1159,14 @@
type: string
required: false
description: default isolation to use when bringing up instances (default to 'vm')
+ network:
+ type: string
+ required: false
+ description: type of networking to use for this slice
+ exposed_ports:
+ type: string
+ required: false
+ description: comma-separated list of protocol _space_ port that represent ports the slice should expose
default_flavor:
# Note: we should probably formally introduce flavors to Tosca
# at some point, and use a requirement/relationship instead of
@@ -1155,14 +1178,6 @@
type: string
required: false
description: default node to use for this slice
- network:
- type: string
- required: false
- description: type of networking to use for this slice
- exposed_ports:
- type: string
- required: false
- description: comma-separated list of protocol _space_ port that represent ports the slice should expose
tosca.nodes.Node:
derived_from: tosca.nodes.Root
@@ -1207,6 +1222,31 @@
node:
type: tosca.capabilities.xos.NodeLabel
+ tosca.nodes.Flavor:
+ derived_from: tosca.nodes.Root
+ description: >
+ An XOS Flavor.
+ properties:
+ no-delete:
+ type: boolean
+ default: false
+ description: Do not allow Tosca to delete this object
+ no-create:
+ type: boolean
+ default: false
+ description: Do not allow Tosca to create this object
+ no-update:
+ type: boolean
+ default: false
+ description: Do not allow Tosca to update this object
+ flavor:
+ type: string
+ required: false
+ description: openstack flavor name
+ capabilities:
+ flavor:
+ type: tosca.capabilities.xos.Flavor
+
tosca.nodes.DashboardView:
derived_from: tosca.nodes.Root
description: >
@@ -1356,6 +1396,14 @@
derived_from: tosca.relationships.Root
valid_target_types: [ tosca.capabilities.xos.NodeLabel ]
+ tosca.relationships.SupportsFlavor:
+ derived_from: tosca.relationships.Root
+ valid_target_types: [ tosca.capabilities.xos.Flavor ]
+
+ tosca.relationships.DefaultFlavor:
+ derived_from: tosca.relationships.Root
+ valid_target_types: [ tosca.capabilities.xos.Flavor ]
+
tosca.relationships.ProvidesAddresses:
derived_from: tosca.relationships.Root
valid_target_types: [ tosca.capabilities.xos.AddressPool ]
@@ -1411,6 +1459,10 @@
derived_from: tosca.capabilities.Root
description: An XOS NodeLabel
+ tosca.capabilities.xos.Flavor:
+ derived_from: tosca.capabilities.Root
+ description: An XOS Flavor
+
tosca.capabilities.xos.Image:
derived_from: tosca.capabilities.Root
description: An XOS Image
diff --git a/xos/tosca/resources/flavor.py b/xos/tosca/resources/flavor.py
new file mode 100644
index 0000000..f61ccad
--- /dev/null
+++ b/xos/tosca/resources/flavor.py
@@ -0,0 +1,37 @@
+# note: this module named xossite.py instead of site.py due to conflict with
+# /usr/lib/python2.7/site.py
+
+import os
+import pdb
+import sys
+import tempfile
+sys.path.append("/opt/tosca")
+from translator.toscalib.tosca_template import ToscaTemplate
+
+from core.models import User, Deployment, Flavor
+
+from xosresource import XOSResource
+
+class XOSFlavor(XOSResource):
+ provides = "tosca.nodes.Flavor"
+ xos_model = Flavor
+ copyin_props = ["flavor"]
+
+ def get_xos_args(self):
+ args = super(XOSFlavor, self).get_xos_args()
+
+ # Support the default where the OpenStack flavor is the same as the
+ # flavor name
+ if "flavor" not in args:
+ args["flavor"] = args["name"]
+
+ return args
+
+ def delete(self, obj):
+ if obj.instance_set.exists():
+ self.info("Flavor %s has active instances; skipping delete" % obj.name)
+ return
+ super(XOSFlavor, self).delete(obj)
+
+
+