Add networking sfc library
Library provides set of classes for MuranoPL language to manage Networking SFC objects in Neutron: * FlowClassifier * PortChain * PortPair * PortPairGroup Adds utility classes to extend MuranoPL core library: * Instance * NeutronPort Change-Id: I3f3d24dffbe572ea13da599920cc501d41085643
This commit is contained in:
parent
bdb2a39be1
commit
589745707c
|
@ -0,0 +1,93 @@
|
|||
# Copyright 2016 Mirantis, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
Namespaces:
|
||||
=: org.openstack.networkingSfc
|
||||
std: io.murano
|
||||
|
||||
Name: FlowClassifier
|
||||
|
||||
Properties:
|
||||
id:
|
||||
Contract: $.string()
|
||||
Usage: Out
|
||||
|
||||
name:
|
||||
Contract: $.string()
|
||||
|
||||
description:
|
||||
Contract: $.string()
|
||||
|
||||
ethertype:
|
||||
Contract: $.string().notNull()
|
||||
Default: 'IPv4'
|
||||
|
||||
protocol:
|
||||
Contract: $.string()
|
||||
|
||||
sourcePortMin:
|
||||
Contract: $.int()
|
||||
|
||||
sourcePortMax:
|
||||
Contract: $.int()
|
||||
|
||||
destinationPortMin:
|
||||
Contract: $.int()
|
||||
|
||||
destinationPortMax:
|
||||
Contract: $.int()
|
||||
|
||||
sourceIpPrefix:
|
||||
Contract: $.string()
|
||||
|
||||
destinationIpPrefix:
|
||||
Contract: $.string()
|
||||
|
||||
logicalSourcePort:
|
||||
Contract: $.class(NeutronPort).notNull()
|
||||
|
||||
logicalDestinationPort:
|
||||
Contract: $.class(NeutronPort).notNull()
|
||||
|
||||
Methods:
|
||||
.init:
|
||||
Body:
|
||||
- $env: $.find(std:Environment).require()
|
||||
- $.sfcClient: new('io.murano.extensions.networking_sfc.NetworkingSfcClient', $env)
|
||||
|
||||
deploy:
|
||||
Body:
|
||||
- If: $.getAttr(deployed, false)
|
||||
Then:
|
||||
- Return: null
|
||||
|
||||
- $data: $.sfcClient.createFlowClassifier(
|
||||
name => $.name, description => $.description,
|
||||
ethertype => $.ethertype, protocol => $.protocol,
|
||||
source_port_range_min => $.sourcePortMin,
|
||||
source_port_range_max => $.sourcePortMax,
|
||||
destination_port_range_min => $.destinationPortMin,
|
||||
destination_port_range_max => $.destinationPortMax,
|
||||
source_ip_prefix => $.sourceIpPrefix,
|
||||
destination_ip_prefix => $.destinationIpPrefix,
|
||||
logical_source_port => $.logicalSourcePort.openstackId,
|
||||
logical_destination_port => $.logicalDestinationPort.openstackId)
|
||||
- $.id: $data.id
|
||||
- $.setAttr(deployed, true)
|
||||
|
||||
.destroy:
|
||||
Body:
|
||||
- If: $.getAttr(deployed, false)
|
||||
Then:
|
||||
- $.sfcClient.deleteFlowClassifier($.id)
|
|
@ -0,0 +1,47 @@
|
|||
# Copyright 2016 Mirantis, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
Namespaces:
|
||||
=: org.openstack.networkingSfc
|
||||
std: io.murano
|
||||
res: io.murano.resources
|
||||
|
||||
Name: Instance
|
||||
|
||||
Extends: res:LinuxMuranoInstance
|
||||
|
||||
Properties:
|
||||
ports:
|
||||
Contract: [$.class(NeutronPort).notNull()]
|
||||
Default: []
|
||||
|
||||
Methods:
|
||||
prepareStackTemplate:
|
||||
Arguments:
|
||||
instanceTemplate:
|
||||
Contract: {}
|
||||
Body:
|
||||
- For: port
|
||||
In: $.ports
|
||||
Do:
|
||||
- $port.deploy()
|
||||
- $template:
|
||||
resources:
|
||||
$.name:
|
||||
properties:
|
||||
networks:
|
||||
- port:
|
||||
$port.getRef()
|
||||
- $instanceTemplate: $instanceTemplate.mergeWith($template)
|
||||
- Return: $instanceTemplate
|
|
@ -0,0 +1,67 @@
|
|||
# Copyright 2016 Mirantis, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
Namespaces:
|
||||
=: org.openstack.networkingSfc
|
||||
std: io.murano
|
||||
res: io.murano.resources
|
||||
|
||||
Name: NeutronPort
|
||||
|
||||
Properties:
|
||||
network:
|
||||
Contract: $.class(res:Network).notNull()
|
||||
name:
|
||||
Contract: $.string()
|
||||
Usage: Out
|
||||
openstackId:
|
||||
Contract: $.string()
|
||||
Usage: Out
|
||||
|
||||
Methods:
|
||||
.init:
|
||||
Body:
|
||||
- $._environment: $.find(std:Environment).require()
|
||||
|
||||
deploy:
|
||||
Body:
|
||||
- If: $.getAttr(deployed, false)
|
||||
Then:
|
||||
- Return: null
|
||||
|
||||
- $.name: format('port-{0}', id($))
|
||||
- $networkData: $.network.describe()
|
||||
- $template:
|
||||
resources:
|
||||
$.name:
|
||||
type: 'OS::Neutron::Port'
|
||||
properties:
|
||||
network_id: $networkData.netId
|
||||
replacement_policy: AUTO
|
||||
port_security_enabled: false
|
||||
outputs:
|
||||
format('{0}-id', $.name):
|
||||
value:
|
||||
get_resource: $.name
|
||||
- $._environment.stack.updateTemplate($template)
|
||||
- $._environment.stack.push()
|
||||
|
||||
- $outputs: $._environment.stack.output()
|
||||
- $.openstackId: $outputs.get(format('{0}-id', $.name))
|
||||
- $.setAttr(deployed, true)
|
||||
|
||||
getRef:
|
||||
Body:
|
||||
Return:
|
||||
get_resource: $.name
|
|
@ -0,0 +1,67 @@
|
|||
# Copyright 2016 Mirantis, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
Namespaces:
|
||||
=: org.openstack.networkingSfc
|
||||
std: io.murano
|
||||
|
||||
Name: PortChain
|
||||
|
||||
Properties:
|
||||
id:
|
||||
Contract: $.string()
|
||||
Usage: Out
|
||||
|
||||
name:
|
||||
Contract: $.string()
|
||||
|
||||
description:
|
||||
Contract: $.string()
|
||||
|
||||
portPairGroups:
|
||||
Contract: [$.class(PortPairGroup).notNull()]
|
||||
|
||||
flowClassifiers:
|
||||
Contract: [$.class(FlowClassifier).notNull()]
|
||||
|
||||
Methods:
|
||||
.init:
|
||||
Body:
|
||||
- $env: $.find(std:Environment).require()
|
||||
- $.sfcClient: new('io.murano.extensions.networking_sfc.NetworkingSfcClient', $env)
|
||||
|
||||
deploy:
|
||||
Body:
|
||||
- If: $.getAttr(deployed, false)
|
||||
Then:
|
||||
- Return: null
|
||||
|
||||
- $.portPairGroups.select($.deploy())
|
||||
- $portPairGroupIds: $.portPairGroups.id
|
||||
|
||||
- $.flowClassifiers.select($.deploy())
|
||||
- $flowClassifierIds: $.flowClassifiers.id
|
||||
|
||||
- $data: $.sfcClient.createPortChain(
|
||||
name => $.name, description => $.description,
|
||||
port_pair_groups => $portPairGroupIds,
|
||||
flow_classifiers => $flowClassifierIds)
|
||||
- $.id: $data.id
|
||||
- $.setAttr(deployed, true)
|
||||
|
||||
.destroy:
|
||||
Body:
|
||||
- If: $.getAttr(deployed, false)
|
||||
Then:
|
||||
- $.sfcClient.deletePortChain($.id)
|
|
@ -0,0 +1,60 @@
|
|||
# Copyright 2016 Mirantis, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
Namespaces:
|
||||
=: org.openstack.networkingSfc
|
||||
std: io.murano
|
||||
|
||||
Name: PortPair
|
||||
|
||||
Properties:
|
||||
id:
|
||||
Contract: $.string()
|
||||
Usage: Out
|
||||
|
||||
name:
|
||||
Contract: $.string()
|
||||
|
||||
description:
|
||||
Contract: $.string()
|
||||
|
||||
ingress:
|
||||
Contract: $.class(NeutronPort).notNull()
|
||||
|
||||
egress:
|
||||
Contract: $.class(NeutronPort).notNull()
|
||||
|
||||
Methods:
|
||||
.init:
|
||||
Body:
|
||||
- $env: $.find(std:Environment).require()
|
||||
- $.sfcClient: new('io.murano.extensions.networking_sfc.NetworkingSfcClient', $env)
|
||||
|
||||
deploy:
|
||||
Body:
|
||||
- If: $.getAttr(deployed, false)
|
||||
Then:
|
||||
- Return: null
|
||||
|
||||
- $data: $.sfcClient.createPortPair(
|
||||
name => $.name, description => $.description,
|
||||
ingress => $.ingress.openstackId, egress => $.egress.openstackId)
|
||||
- $.id: $data.id
|
||||
- $.setAttr(deployed, true)
|
||||
|
||||
.destroy:
|
||||
Body:
|
||||
- If: $.getAttr(deployed, false)
|
||||
Then:
|
||||
- $.sfcClient.deletePortPair($.id)
|
|
@ -0,0 +1,60 @@
|
|||
# Copyright 2016 Mirantis, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
Namespaces:
|
||||
=: org.openstack.networkingSfc
|
||||
std: io.murano
|
||||
|
||||
Name: PortPairGroup
|
||||
|
||||
Properties:
|
||||
id:
|
||||
Contract: $.string()
|
||||
Usage: Out
|
||||
|
||||
name:
|
||||
Contract: $.string()
|
||||
|
||||
description:
|
||||
Contract: $.string()
|
||||
|
||||
portPairs:
|
||||
Contract: [$.class(PortPair).notNull()]
|
||||
|
||||
Methods:
|
||||
.init:
|
||||
Body:
|
||||
- $env: $.find(std:Environment).require()
|
||||
- $.sfcClient: new('io.murano.extensions.networking_sfc.NetworkingSfcClient', $env)
|
||||
|
||||
deploy:
|
||||
Body:
|
||||
- If: $.getAttr(deployed, false)
|
||||
Then:
|
||||
- Return: null
|
||||
|
||||
- $.portPairs.select($.deploy())
|
||||
- $portPairIds: $.portPairs.id
|
||||
|
||||
- $data: $.sfcClient.createPortPairGroup(
|
||||
name => $.name, description => $.description,
|
||||
port_pairs => $portPairIds)
|
||||
- $.id: $data.id
|
||||
- $.setAttr(deployed, true)
|
||||
|
||||
.destroy:
|
||||
Body:
|
||||
- If: $.getAttr(deployed, false)
|
||||
Then:
|
||||
- $.sfcClient.deletePortPairGroup($.id)
|
|
@ -0,0 +1,33 @@
|
|||
# Copyright 2016 Mirantis, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
Format: 1.3
|
||||
Type: Library
|
||||
Name: Networking SFC Library
|
||||
FullName: org.openstack.networkingSfc
|
||||
Description: >
|
||||
Integration with networking-sfc extension for OpenStack Neutron.
|
||||
Author: 'Mirantis, Inc'
|
||||
Tags: [SFC, Neutron]
|
||||
|
||||
Classes:
|
||||
org.openstack.networkingSfc.FlowClassifier: FlowClassifier.yaml
|
||||
org.openstack.networkingSfc.Instance: Instance.yaml
|
||||
org.openstack.networkingSfc.NeutronPort: NeutronPort.yaml
|
||||
org.openstack.networkingSfc.PortChain: PortChain.yaml
|
||||
org.openstack.networkingSfc.PortPair: PortPair.yaml
|
||||
org.openstack.networkingSfc.PortPairGroup: PortPairGroup.yaml
|
||||
|
||||
Require:
|
||||
murano-plugin-networking-sfc:
|
Loading…
Reference in New Issue