diff --git a/example/SfcDemoApp/Classes/SfcDemoApp.yaml b/example/SfcDemoApp/Classes/SfcDemoApp.yaml index 4406434..486930b 100644 --- a/example/SfcDemoApp/Classes/SfcDemoApp.yaml +++ b/example/SfcDemoApp/Classes/SfcDemoApp.yaml @@ -16,7 +16,7 @@ Namespaces: res: io.murano.resources conf: io.murano.configuration netsfc: org.openstack.networkingSfc - + sys: io.murano.system Name: SfcDemoApp Extends: std:Application @@ -86,9 +86,30 @@ Methods: - $._log.report($this, 'Creating port chain...') - $.createSfcChain() - - - $._log.report($this, 'Done.') + - $.deploySoftware('left-endpoint', $.leftInstance.instance) + - $.deploySoftware('right-endpoint', $.rightInstance.instance) + - $.deploySoftware('sfc-app', $.sfcInstance.instance) + - $host: $.sfcInstance.instance.ipAddresses[0] - $.setAttr(deployed, true) + - $._log.report($this, format('Ntop is available at http://{0} admin/r00tme', $host)) + + + deploySoftware: + Arguments: + - deployType: + Contract: $.string().notNull() + - instance: + Contract: $.class(netsfc:Instance).notNull() + + Body: + - $resources: new(sys:Resources) + - $template: $resources.yaml('SFCDemo.template').bind(dict( + deployType => $deployType, + sourceIp => $.leftInstance.instance.ipAddresses[0], + destinationIp => $.rightInstance.instance.ipAddresses[0])) + - $instance.agent.call($template, $resources) + - $._log.report($this, $name) + deploySfcInstance: Body: @@ -103,6 +124,7 @@ Methods: netsfc:Instance, $this, name => "sfc-instance", flavor => $.flavor, image => $.image, keyname => $.keyname, ports => [$.sfcInstance.port], networks => $networks) + - $._log.report($this, '$.sfcInstance.instance.deploy()') - $.sfcInstance.instance.deploy() diff --git a/example/SfcDemoApp/Resources/SFCDemo.template b/example/SfcDemoApp/Resources/SFCDemo.template new file mode 100644 index 0000000..b6a5ed0 --- /dev/null +++ b/example/SfcDemoApp/Resources/SFCDemo.template @@ -0,0 +1,34 @@ +# 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. + +FormatVersion: 2.0.0 +Version: 1.0.0 +Name: Deploy SFC Demo + +Parameters: + deployType: $deployType + sourceIp: $sourceIp + destinationIp: $destinationIp + +Body: | + return SFCDemoDeploy('{0} {1} {2}'.format(args.deployType, args.sourceIp, args.destinationIp)).stdout + +Scripts: + SFCDemoDeploy: + Type: Application + Version: 1.0.0 + EntryPoint: runSFCDemoDeploy.sh + Files: [] + Options: + captureStdout: true + captureStderr: true + diff --git a/example/SfcDemoApp/Resources/scripts/runSFCDemoDeploy.sh b/example/SfcDemoApp/Resources/scripts/runSFCDemoDeploy.sh new file mode 100644 index 0000000..d03c70d --- /dev/null +++ b/example/SfcDemoApp/Resources/scripts/runSFCDemoDeploy.sh @@ -0,0 +1,80 @@ +#!/bin/bash +# 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. + +srv(){ + + sudo dd of=/etc/init/sfc-generator.conf </dev/null || true + done +end script +EOF + sudo initctl start sfc-receiver + +} + +sfc(){ + sudo apt-get -y install debconf-utils + echo "ntop ntop/admin_password_again password r00tme +ntop ntop/admin_password password r00tme +ntop ntop/user string ntop +ntop ntop/interfaces string eth0 +" | sudo debconf-set-selections + sudo apt-get -y install ntop + +} + +sudo apt-get update +case "$1" in + "sfc-app" ) + sfc + ;; + "left-endpoint" ) + srv $3 + ;; + "right-endpoint" ) + rcv +esac + + diff --git a/example/SfcDemoApp/logo.png b/example/SfcDemoApp/logo.png new file mode 100644 index 0000000..8a2e433 Binary files /dev/null and b/example/SfcDemoApp/logo.png differ diff --git a/example/SfcDemoApp/manifest.yaml b/example/SfcDemoApp/manifest.yaml index 348d7c4..36c4ccf 100644 --- a/example/SfcDemoApp/manifest.yaml +++ b/example/SfcDemoApp/manifest.yaml @@ -14,7 +14,14 @@ Format: 1.3 Type: Application FullName: com.example.SfcDemoApp Name: SFC Test App -Description: Networking SFC test application +Description: | + Networking SFC test application. + This application spawns three VMs. Between two of them traffic is being + pushed using netcat. The third is connected in the middle using Networking + SFC and ntopng software is deployed there for web-based traffic analysis. + It allows to observe traffic between left and right VMs which is flowing + using Networking SFC functionality. + Author: 'Mirantis, Inc' Tags: [Server] Classes: