$ ./bin/karaf
opendaylight-user@root>feature:install odl-vtn-manager-neutron odl-vtn-manager-rest
使用用户名和密码登录到mininet-vm。
用户名:mininet
密码:mininet
使用主动模式连接两个OvS。
$ sudo ovs-vsctl set-manager tcp:${CONTROLLER_IP}:6640
其中,$ {CONTROLLER_IP}是运行OpenDaylight的主机的IP地址。
现在,我们的虚拟交换机已连接到OpenDaylight:
mininet@mininet-vm:~$ sudo ovs-vsctl show
0b8ed0aa-67ac-4405-af13-70249a7e8a96
Manager "tcp:192.168.0.115:6640"
is_connected: true
ovs_version: "2.3.1"
$ sudo mn --controller = remote,ip = $ {CONTROLLER_IP} --topo tree,2
使用以下命令查看拓扑:
mininet> net
mininet> h1 ping h3
mininet> h1 ping h3
PING 10.0.0.3 (10.0.0.3) 56(84) bytes of data.
From 10.0.0.1 icmp_seq=1 Destination Host Unreachable
From 10.0.0.1 icmp_seq=2 Destination Host Unreachable
From 10.0.0.1 icmp_seq=3 Destination Host Unreachable
^C
--- 10.0.0.3 ping statistics ---
5 packets transmitted, 0 received, +3 errors, 100% packet
loss, time 4024ms
$ sudo ovs-ofctl add-flow s1 priority = 0,actions = output:CONTROLLER
$ sudo ovs-ofctl add-flow s2 priority = 0,actions = output:CONTROLLER
$ sudo ovs-ofctl add-flow s3 priority = 0,actions = output:CONTROLLER
type: POST
headers: Authorization: Basic YWRtaW46YWRtaW4=
url: http://localhost:8181/restconf/operations/vtn:update-vtn
payload:
{
"input":{
"tenant-name":"vtn1"
}
}
你会收到代码200 OK的反馈信息。
type: POST
headers: Authorization: Basic YWRtaW46YWRtaW4=
url: http://localhost:8181/restconf/operations/vtn:update-vtn
payload:
{
"input":{
"tenant-name":"vtn1",
"bridge-name":"vbr1"
}
}
你应该会收到代码200 OK的反馈信息。
type: POST
headers: Authorization: Basic YWRtaW46YWRtaW4=
url:
http://localhost:8181/restconf/operations/vtn-vinterface:update-vinterface
payload:
{
"input":{
"tenant-name":"vtn1",
"bridge-name":"vbr1",
"interface-name":"if1"
}
}
收到代码200 OK的反馈信息。
重复此请求以创建第二个接口,但更改接口名称与if2。
type: POST
headers:Authorization: Basic YWRtaW46YWRtaW4=
url:
http://localhost:8181/restconf/operations/vtn-port-map:set-port-map
payload for host 1:
{
"input":{
"tenant-name":"vtn1",
"bridge-name":"vbr1",
"interface-name":"if1",
"node":"openflow:2",
"port-name":"s2-eth1"
}
}
mininet> h1 ping h3
PING 10.0.0.3 (10.0.0.3) 56(84) bytes of data.
64 bytes from 10.0.0.3: icmp_seq=1
ttl=64 time=47.4 ms
64 bytes from 10.0.0.3: icmp_seq=2
ttl=64 time=0.220 ms
64 bytes from 10.0.0.3: icmp_seq=3
ttl=64 time=0.055 ms
64 bytes from 10.0.0.3: icmp_seq=4
ttl=64 time=0.150 ms
^C
--- 10.0.0.3 ping statistics ---
4 packets transmitted, 4 received,
0% packet loss, time
3002ms
rtt min/avg/max/mdev =
0.055/11.968/47.450/20.485 ms
mininet@mininet-vm:~$ sudo ovs-ofctl dump-flows s1 -O OpenFlow13
OFPST_FLOW reply (OF1.3) (xid=0x2):
cookie=0x0, duration=123.379s, table=0, n_packets=48, n_bytes=4080,
priority=0 actions=CONTROLLER:65535
cookie=0x7f56000000000001, duration=118.249s, table=0, n_packets=4,
n_bytes=336, send_flow_rem
priority=10,in_port=2,vlan_tci=0x0000/0x1fff,dl_src=a6:33:4c:dd:fb:9f,
dl_dst=92:bd:3b:89:75:6b actions=output:1
cookie=0x7f56000000000002, duration=118.243s, table=0, n_packets=4,
n_bytes=336, send_flow_rem
priority=10,in_port=1,vlan_tci=0x0000/0x1fff,dl_src=92:bd:3b:89:75:6b,
dl_dst=a6:33:4c:dd:fb:9f actions=output:2
type: GET
headers:Authorization: Basic YWRtaW46YWRtaW4=
url:
http://localhost:8181/restconf/operational/vtn:vtns/
删除租户的完整配置:
type: POST
headers: Authorization: Basic YWRtaW46YWRtaW4=
url:
http://localhost:8181/restconf/operations/vtn:remove
-vtn
payload:
{
"input":{
"tenant-name":"vtn1"
}
}
$ ./bin/karaf
opendaylight-user@root>feature:
install feature:install odl-neutron-service
完成安装可能需要一分钟左右。
$ web:list
Beryllium-SR: https: //raw. githubusercontent. com/j goodyear/OpenDayl
ightCookbook/master/chapter5/chapter5-recipe2/src/main/resources
/features-neutron-test-0. 6. 0-Beryllium-features. xml
Beryllium-SR1:
https: //raw. githubusercontent. com/j goodyear/OpenDaylightCookbook
/master/chapter5/chapter5-recipe2/src/main/resources/features-ne
utron-test-0. 6. 1-Beryllium-SR1-features. xml
Beryllium-SR2:
https: //raw. githubusercontent. com/j goodyear/OpenDaylightCookbook
/master/chapter5/chapter5-recipe2/src/main/resources/features-ne
utron-test-0. 6. 2-Beryllium-SR2-features. xml
$ feature:repo-add
https://nexus.opendaylight.org/content/
repositories/opendaylight.release/org/
opendaylight/neutron/
features-neutron-test/0.6.0-Beryllium/
features-neutron-test-0.6.0-Beryllium-features.xml
添加后,安装dummy-provider功能:
$ feature:install odl-neutron-dummyprovider-test
type: POST
headers: Authorization: Basic YWRtaW46YWRtaW4=
url:
http://localhost:8080/controller/nb/v2/neutron/networks/
payload:
{
"networks":[ {
"status":"ACTIVE",
"subnets":[],
"name":"network1",
"admin_state_up":true,
"tenant_id:
"60cd4f6dbc5f499982a284e7b83b5be3",
"provider:network_type":"local",
"router:external":false,
"shared":false,
"id":"e9330b1f-a2ef-4160-
a991-169e56ab17f5",
"provider:segmentation_id":100
} ]
}
type: POST
headers: Authorization: Basic YWRtaW46YWRtaW4=
url:
http://localhost:8080/controller/nb/v2/neutron/subnets/
payload:
{
"subnet": {
"name": "",
"enable_dhcp": true,
"network_id": "e9330b1f-a2ef-
4160-a991-169e56ab17f5",
"tenant_id":
"4fd44f30292945e481c7b8a0c8908869",
"dns_nameservers": [],
"allocation_pools": [ {
"start": "192.168.199.2",
"end": "192.168.199.254"
} ],
"host_routes": [],
"ip_version": 4,
"gateway_ip": "192.168.199.1",
"cidr": "192.168.199.0/24",
"id": "3b80198d-4f7b-4f77-9ef5
-774d54e17126"
}
}
type: POST
headers:Authorization: Basic YWRtaW46YWRtaW4=
url:
http://localhost:8080/controller/nb/v2/neutron/ports/
payload:
{
"port": {
"status": "DOWN",
"binding:host_id": "",
"name": "port1",
"allowed_address_pairs": [],
"admin_state_up": true,
"network_id": "e9330b1f-a2ef-
4160-a991-169e56ab17f5",
"tenant_id": "4fd44f30292945e481c
7b8a0c8908869",
"binding:vif_details": {},
"binding:vnic_type": "normal",
"binding:vif_type": "unbound",
"mac_address": "fa:16:3e:c9:cb:f0",
"binding:profile": {},
"fixed_ips": [ {
"subnet_id":
"3b80198d-4f7b-4f77-
9ef5774d54e17126",
"ip_address": "192.168.199.1"
} ],
"id": "65c0ee9f-d634-4522-8954-
51021b570b0d"
}
}
OpenStack control and compute – devstack – OvS – CentOS7
OpenStack compute – devstack – OvS – CentOS7
Router for external access – CentOS6.5
File | Import Appliance
ovsdbtutorial15_2_liberty_be_external.ova
odl31-control, odl32-compute, router-node
$ ssh odl@192.168.50.31
$ ssh odl@192.168.50.32
http: //docs. openstack. org/developer/devstack/
LOGFILE=/opt/stack/logs/stack.sh.log
SCREEN_LOGDIR=/opt/stack/logs
LOG_COLOR=False
OFFLINE=True
RECLONE=no
VERBOSE=TRUE
disable_all_services
n-obj
n-cpu n-cond n-sch n-novnc n-xvnc n-cauth
enable_service horizon
enable_service neutron q-dhcp q-meta q-svc
odl-compute odl-neutron
HOST_IP=192.168.254.31
HOST_NAME=odl31
SERVICE_HOST_NAME=$HOST_NAME
SERVICE_HOST=$HOST_IP
Q_HOST=$SERVICE_HOST
enable_plugin networking-odl
http://git.openstack.org/openstack/networking-odl
ODL_PORT=8080
ODL_MGR_IP=192.168.2.11
ODL_L3=True
ODL_PROVIDER_MAPPINGS=br-ex:eth2
http: //docs. openstack. org/developer/devstack/configuration. html#local-conf
$ vi /opt/devstack/local.conf
$ vi etc / custom.properties
ovsdb.l3.fwd.enabled = yes
$ ./bin/karaf
opendaylight-user@root>feature:install odl-ovsdb-openstack
$ cd /opt/devstack
$ ./stack.sh
This is your host IP address: 192.168.254.31
This is your host IPv6 address: ::1
Horizon is now available at
http://192.168.254.31/dashboard
Keystone is serving at
http://192.168.254.31:5000/
The default users are: admin and demo
The password: admin
[odl@odl31 devstack]$ sudo ovs-vsctl show
6b96af57-f05b-4663-9e1d-180c0c788a5b
Manager "tcp:192.168.1.164:6640"
is_connected: true
Bridge br-ex
Controller "tcp:192.168.1.164:6653"
is_connected: true
fail_mode: secure
Port br-ex
Interface br-ex
type: internal
Bridge br-int
Controller "tcp:192.168.1.164:6653"
is_connected: true
fail_mode: secure
Port br-int
Interface br-int
type: internal
ovs_version: "2.4.0"
[odl@odl32 stack]$ sudo ovs-ofctl dump-flows br-int –O OpenFlow13
OFPST_FLOW reply (OF1.3) (xid=0x2):
cookie=0x0, duration=2688.686s, table=0, n_packets=0,
n_bytes=0, dl_type=0x88cc actions=CONTROLLER:65535
cookie=0x0, duration=2688.649s, table=0, n_packets=0,
n_bytes=0, priority=0 actions=goto_table:20
cookie=0x0, duration=2688.649s, table=20, n_packets=0,
n_bytes=0, priority=0 actions=goto_table:30
cookie=0x0, duration=2688.649s, table=30, n_packets=0,
n_bytes=0, priority=0 actions=goto_table:40
cookie=0x0, duration=2688.649s, table=40, n_packets=0,
n_bytes=0, priority=0 actions=goto_table:50
cookie=0x0, duration=2688.649s, table=50, n_packets=0,
n_bytes=0, priority=0 actions=goto_table:60
cookie=0x0, duration=2688.649s, table=60, n_packets=0,
n_bytes=0, priority=0 actions=goto_table:70
cookie=0x0, duration=2688.649s, table=70, n_packets=0,
n_bytes=0, priority=0 actions=goto_table:80
cookie=0x0, duration=2688.649s, table=80, n_packets=0,
n_bytes=0, priority=0 actions=goto_table:90
cookie=0x0, duration=2688.649s, table=90, n_packets=0,
n_bytes=0, priority=0 actions=goto_table:100
cookie=0x0, duration=2688.649s, table=100, n_packets=0,
n_bytes=0, priority=0 actions=goto_table:110
cookie=0x0, duration=2688.649s, table=110, n_packets=0,
n_bytes=0, priority=0 actions=drop
[odl@odl32 stack]$ sudo ovs-ofctl dump-flows br-ex –O OpenFlow13
OFPST_FLOW reply (OF1.3) (xid=0x2):
cookie=0x0, duration=2700.054s, table=0, n_packets=0,
n_bytes=0, dl_type=0x88cc actions=CONTROLLER:65535
cookie=0x0, duration=2700.054s, table=0, n_packets=0,
n_bytes=0, priority=0 actions=NORMAL
$ source openrc admin admin
$ nova flavor-create m1.nano auto 64 0 1
/opt/tools/os_addnano.sh。
$ nova keypair-add --pub-key ~/.ssh / id_rsa.pub admin_key
/opt/tools/os_addadminkey.sh。
$ neutron net-create ext-net --router:external
--provider:physical_network public
-- provider:network_type flat
$ neutron subnet-create --name ext-subnet
--allocation-pool
start=192.168.56.9,end=192.168.56.14
--disable-dhcp --gateway 192.168.56.1
ext-net 192.168.56.0/24
$ neutron router-create ext-rtr
$ neutron router-gateway-set ext-rtr ext-net
$ neutron net-create vx-net
--provider:network_type vxlan
--provider:segmentation_id 1500
$ neutron subnet-create vx-net 10.100.5.0/24
--name vx-subnet --dns-nameserver 8.8.8.8
$ neutron router-interface-add ext-rtr vx-subnet
/opt/tools/os_addextnetrtr.sh.
$ nova boot --poll --flavor m1.nano --image
$(nova image-list | grep 'uec\s' |
awk '{print $2}' | tail -1)
--nic net-id=$(neutron net-list |
grep -w vx-net | awk '{print $2}') vmvx1
--availability_zone=nova:odl31 --key_name admin_key
$ nova boot --poll --flavor m1.nano --image
$(nova image-list | grep 'uec\s' |
awk '{print $2}' | tail -1)
--nic net-id=$(neutron net-list | grep -w vx-net |
awk '{print $2}') vmvx2
--availability_zone=nova:odl32 --key_name admin_key
$ nova get-vnc-console vmvx1 novnc
$ nova get-vnc-console vmvx2 novnc
/opt/tools/os_addvms.sh.
vm_id=$(nova list | grep $vm | awk '{print
$2}')
port_id=$(neutron port-list -c id -c fixed_ips
--
--device_id $vm_id | grep subnet_id | awk
'{print $2}')
neutron floatingip-create --port_id $port_id
ext-net
done;
/opt/tools/os_addfloatingips.sh.
opendaylight-user@root>feature:install odl-ovsdb-ui
https: //github. com/j goodyear/OpenDaylightCookbook/blob/master/chapter5/chapter5-recipe4/src/main/resources/control-node-topo. txt
https: //github. com/j goodyear/OpenDaylightCookbook/blob/master/chapter5/chapter5-recipe4/src/main/resources/compute-node-topo. txt
https://github.com/opendaylight/sfc/tree/release/beryllium-sr2/sfc-demo/sfc103
$ git clone
https://git.opendaylight.org/gerrit/sfc
$ cd sfc
$ git checkout tabs/release/beryllium-sr2
$ cd sfc-demo/sfc103/
$ ./demo.sh
$ wget
$ ./setup_odl.sh
$ wget
$ ./setup_prerequisites.sh
$ rmmod openvswitch
$ find /lib/modules | grep openvswitch.ko| xargs rm -rf
$ curl https://raw.githubusercontent.com/priteshk/ovs/nsh-v8/third-party/start-ovs-deb.sh | bash
$ sudo ovs-vsctl set-manager tcp:192.168.1.5:6640
$ sudo ovs-vsctl add-br br-sfc
$ ip netns add app
$ ip link add veth-app type veth peer
name veth-br
$ ip link set veth-app netns app
$ sudo ovs-vsctl add-port br-sfc veth-br
$ ip link set dev veth-br up
$ ip netns exec app ifconfig veth-app 192.168.2.1/24 up
$ ip netns exec app ip link set dev veth-app addr 00:00:11:11:11:11
$ ip netns exec app arp -s 192.168.2.200:00:22:22:22:22 -i veth-app
$ ip netns exec app ip link set dev veth-app up
$ ip netns exec app ip link set dev lo up
$ ip netns exec app ifconfig veth-app mtu 1400
$ ip netns exec app arp -s 192.168.2.100:00:11:11:11:11-i veth-app
$ ip netns exec app python -m SimpleHTTPServer 80
$ wget
$ ./setup_prerequisites.sh
$ rmmod openvswitch
$ find /lib/modules | grep openvswitch.ko| xargs rm -rf
$ curl https://raw.githubusercontent.com/priteshk/ovs/nsh-v8/third-party/start-ovs-deb.sh | bash
$ sudo ovs-vsctl set-manager tcp:192.168.1.5:6640
$ wget https://raw.githubusercontent.com/jgoodyear/OpenDaylightCookbook/master/chapter5/chapter5-recipe5/src/main/resources/setup_prerequisites.sh
$ ./setup_prerequisites.sh
$ rmmod openvswitch
$ find /lib/modules | grep openvswitch.ko| xargs rm -rf
$ curl
https://raw.githubusercontent.com/priteshk/ovs/nsh-v8/third-party/start-ovs-deb.sh | bash
$ sudo ovs-vsctl set-manager tcp:192.168.1.5:6640
$ wget
$ ./setup_sf.sh
type: PUT
headers: Authorization: Basic YWRtaW46YWRtaW4=
url:
http://192.168.1.5:8181/restconf/config/service-node:se
rvice-nodes
payload:
{
"service-nodes":{
"service-node":[
{
"name":"node0",
"service-function":[],
"ip-mgmt-address":"192.168.1.10"
},
{
"name":"node1",
"service-function":[],
"ip-mgmt-address":"192.168.1.20"
},
{
"name":"node2",
"service-function":["dpi-1"],
"ip-mgmt-address":"192.168.1.30"
},
{
"name":"node3",
"service-function":["firewall-1"],
"ip-mgmt-address":"192.168.1.40"
},
{
"name":"node4",
"service-function":[],
"ip-mgmt-address":"192.168.1.50"
},
{
"name":"node5",
"service-function":[],
"ip-mgmt-address":"192.168.1.60"
}]
}
}
type: PUT
headers: Authorization: Basic YWRtaW46YWRtaW4=
url:
http://192.168.1.5:8181/restconf/config/service-functio
n:service-functions
payload:
{
"service-functions":{
"service-function":[
{
"name":"dpi-1",
"ip-mgmt-address":"192.168.1.30",
"rest-
uri":"http://192.168.1.30:5000",
"type":"dpi",
"nsh-aware":"true",
"sf-data-plane-locator":[
{
"name":"sf1-dpl",
"port":6633,
"ip":"192.168.1.30",
"transport":"service-
locator:vxlan-gpe",
"service-function
forwarder":"SFF1"
}]
},
{
"name":"firewall-1",
"ip-mgmt-address":"192.168.1.40",
"rest-
uri":"http://192.168.1.40:5000",
"type":"firewall",
"nsh-aware":"true",
"sf-data-plane-locator":[
{
"name":"sf2-dpl",
"port":6633,
"ip":"192.168.1.40",
"transport":"service-
locator:vxlan-gpe",
"service-function-
forwarder":"SFF2"
}]
}]
}
}
type: PUT
headers: Authorization: Basic YWRtaW46YWRtaW4=
url:
http://192.168.1.5:8181/restconf/config/service-functio
n-forwarder:service-function-forwarders
payload: https: //raw. githubusercontent. com/j goodyear/OpenDay
lightCookbook/master/chapter5/chapter5-recipe5/src/main/res
ources/sff.json
type: PUT
headers: Authorization: Basic YWRtaW46YWRtaW4=
url:
http://192.168.1.5:8181/restconf/config/service-functio
n-chain:service-function-chains/
payload:
{
"service-function-chains":{
"service-function-chain":[
{
"name":"SFC1",
"symmetric":"true",
"sfc-service-function":[
{
"name":"dpi-abstract1",
"type":"dpi"
},
{
"name":"firewall-abstract1",
"type":"firewall"
} ]
} ]
}
}
type: PUT
headers: Authorization: Basic YWRtaW46YWRtaW4=
url:
http://192.168.1.5:8181/restconf/config/service-functio
n-path-metadata:service-function-metadata/
payload:
{
"service-function-metadata":{
"context-metadata":[
{
"name":"NSH1",
"context-header1":"1",
"context-header2":"2",
"context-header3":"3",
"context-header4":"4"
} ]
}
}
type: PUT
headers: Authorization: Basic YWRtaW46YWRtaW4=
url:
http://192.168.1.5:8181/restconf/config/service-functio
n-path:service-function-paths/
payload:
{
"service-function-paths":{
"service-function-path":[
{
"name":"SFP1",
"service-chain-name":"SFC1",
"classifier":"Classifier1",
"symmetric-
classifier":"Classifier2",
"context-metadata":"NSH1",
"symmetric":"true"
} ]
}
}
type: PUT
headers: Authorization: Basic YWRtaW46YWRtaW4=
url:
http://192.168.1.5:8181/restconf/config/ietf-access-con
trol-list:access-lists/
payload: https: //raw. githubusercontent. com/j goodyear/OpenDay
lightCookbook/master/chapter5/chapter5-recipe5/src/main/res
ources/acl. j son
type: POST
headers: Authorization: Basic YWRtaW46YWRtaW4=
url:
http://192.168.1.5:8181/restconf/operations/rendered-se
rvice-path:create-rendered-path/
payload:
{
"input": {
"name": "RSP1",
"parent-service-function-path":
"SFP1",
"symmetric": "true"
}
}
type: PUT
headers: Authorization: Basic YWRtaW46YWRtaW4=
url:
http://192.168.1.5:8181/restconf/config/service-functio
n-classifier:service-function-classifiers/
payload:
{
"service-function-classifiers": {
"service-function-classifier": [
{
"name": "Classifier1",
"scl-service-function-forwarder": [
{
"name": "SFF0",
"interface": "veth-br"
} ],
"access-list": "ACL1"
},
{
"name": "Classifier2",
"scl-service-function-forwarder": [
{
"name": "SFF3",
"interface": "veth-br"
} ],
"access-list": "ACL2"
} ]
}
}
$ sudo ovs-ofctl dump-flows -OOpenflow13 br-sfc
$ vagrant destroy –f
欢迎光临 51学通信论坛2017新版 (http://bbs.51xuetongxin.com/) | Powered by Discuz! X3 |