Software deployment procedure added into SfcDemoApp
Change-Id: Ic79d2a6c79e2a3cd0e65edf560114064f939abb6
This commit is contained in:
parent
54252d835c
commit
ba94441f1d
|
@ -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()
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
@ -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 <<EOF
|
||||
# SFC Demo generator
|
||||
#
|
||||
|
||||
description "SFC Demo generator"
|
||||
|
||||
start on runlevel [2345]
|
||||
stop on runlevel [!2345]
|
||||
|
||||
|
||||
script
|
||||
while true ; do
|
||||
dmesg -T true | nc $1 8022 || true
|
||||
done
|
||||
end script
|
||||
EOF
|
||||
sudo initctl start sfc-generator
|
||||
}
|
||||
|
||||
|
||||
rcv(){
|
||||
|
||||
sudo dd of=/etc/init/sfc-receiver.conf <<EOF
|
||||
# SFC Demo receiver
|
||||
#
|
||||
|
||||
description "SFC Demo receiver"
|
||||
|
||||
start on runlevel [2345]
|
||||
stop on runlevel [!2345]
|
||||
|
||||
script
|
||||
while true ; do
|
||||
nc -l 8022 >/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
|
||||
|
||||
|
Binary file not shown.
After Width: | Height: | Size: 2.5 KiB |
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue