官术网_书友最值得收藏!

  • OpenDaylight Cookbook
  • Mathieu Lemay Alexis de Talhou?t Jamie Goodyear Rashmi Pujar Mohamed El Serngawy Yrineu Rodrigues
  • 599字
  • 2021-07-02 21:38:40

How to do it...

Perform the following steps:

  1. Start your OpenDaylight distribution using the karaf script. Using this client will give you access to the Karaf CLI:
$ ./bin/karaf 
  1. Install the user facing feature responsible for pulling in all dependencies needed to use the YANG UI:
opendaylight-user@root>feature:install odl-vpnservice-intent 

It might take a minute or so to complete the installation.

  1. Create the topology in the Mininet-VM:
  • Log in to Mininet-VM using these credentials:
    • Username: mininet
    • Password: mininet
  • Create the custom topology.

The topology's script resides at the following location:

$ wget -O shortest_path.py https://gist.githubusercontent.com/adetalhouet/shortest_path.py
$ sudo mn --controller=remote,ip=${CONTROLLER_IP} --custom ~/shortest_path.py --topo shortest_path --switch ovsk,protocols=OpenFlow13

Here, ${CONTROLLER_IP} is the IP address of the host running OpenDaylight.

The topology looks like the following diagram, where openflow:1 and openflow:3 are the PE switches and openflow: 42/43/44 are the P switches. There are two disjoint routes between the PE switches:

  1. Create a VPN with the desired constraints (slow-reroute or fast-reroute). We will use slow-reroute in this example:
  • Type: POST
  • Headers:

Authorization: Basic YWRtaW46YWRtaW4=

  • URL: http://localhost:8181/restconf/operations/vpnintent:vpns/
  • Payload:
{
"vpn-intents": [
{
"vpn-name": "VPN #1"
"path-protection": "true",
"failover-type": "slow-reroute"
}
]
}
  1. Add the first member to our VPN:
  • Type: POST
  • Headers:

Authorization: Basic YWRtaW46YWRtaW4=

  • URL: http://localhost:8181/restconf/operations/vpnintent:add-vpn-endpoint
  • Payload:
{ 
"input": {
"vpn-name": "VPN #1",
"site-name": "site1",
"ip-prefix": "10.0.0.1/32",
"switch-port-id": "openflow:1:1"
}
}
  1. Add the second member to our VPN:
  • Type: POST
  • Headers:

Authorization: Basic YWRtaW46YWRtaW4=

  • URL: http://localhost:8181/restconf/operations/vpnintent:add-vpn-endpoint
  • Payload:
{ 
"input": {
"vpn-name": "VPN #1",
"site-name": "site2",
"ip-prefix": "10.0.0.3/32",
"switch-port-id": "openflow:3:1"
}
}
  1. Look at the current configuration in the OpenDaylight datastore:
  • Type: GET
  • Headers:

Authorization: Basic YWRtaW46YWRtaW4=

  • URL: http://localhost:8181/restconf/config/vpnintent:vpns/

Result:

<vpns xmlns="urn:opendaylight:params:xml:ns:yang:vpnintent"> 
<vpn-intents>
<vpn-name>VPN #1</vpn-name>
<failover-type>fast-reroute</failover-type>
<path-protection>true</path-protection>
<endpoint>
<site-name>site1</site-name>
<ip-prefix>10.0.0.1/32</ip-prefix>
<switch-port-id>openflow:1:1</switch-port-id>
</endpoint>
<endpoint>
<site-name>site3</site-name>
<ip-prefix>10.0.0.3/32</ip-prefix>
<switch-port-id>openflow:3:1</switch-port-id>
</endpoint>
</vpn-intents>
</vpns>
  1. Look at the flows installed in the OvS instance:
mininet@mininet-vm:~$ sudo ovs-ofctl -O OpenFlow13 dump-flows s1 
OFPST_FLOW reply (OF1.3) (xid=0x2):cookie=0x2, duration=96.839s, table=0, n_packets=0, n_bytes=0, priority=10000,arp actions=CONTROLLER:65535,NORMAL cookie=0x2, duration=96.827s, table=0, n_packets=20, n_bytes=1700, priority=9500,dl_type=0x88cc actions=CONTROLLER:65535 cookie=0x0, duration=7.739s, table=0, n_packets=0, n_bytes=0, priority=9000,ip,nw_src=10.0.0.1,nw_dst=10.0.0.3 actions=push_mpls:0x8847,set_field:494630->mpls_label,output:2 cookie=0x0, duration=7.724s, table=0, n_packets=0, n_bytes=0, priority=9000,mpls,mpls_label=337082,mpls_bos=1 actions=pop_mpls:0x0800,output:1

mininet@mininet-vm:~$ sudo ovs-ofctl -O OpenFlow13 dump-flows s2a
OFPST_FLOW reply (OF1.3) (xid=0x2):cookie=0x3, duration=95.968s, table=0, n_packets=0, n_bytes=0, priority=10000,arp actions=CONTROLLER:65535,NORMAL cookie=0x3, duration=89.545s, table=0, n_packets=37, n_bytes=3145, priority=9500,dl_type=0x88cc actions=CONTROLLER:65535 cookie=0x0, duration=7.747s, table=0, n_packets=0, n_bytes=0, priority=9000,mpls,mpls_label=494630,mpls_bos=1 actions=output:3 cookie=0x0, duration=7.736s, table=0, n_packets=0, n_bytes=0, priority=9000,mpls,mpls_label=337082,mpls_bos=1 actions=output:2

mininet@mininet-vm:~$ sudo ovs-ofctl -O OpenFlow13 dump-flows s3

OFPST_FLOW reply (OF1.3) (xid=0x2): cookie=0x1, duration=97.781s, table=0, n_packets=0, n_bytes=0, priority=10000,arp actions=CONTROLLER:65535,NORMAL cookie=0x1, duration=97.778s, table=0, n_packets=20, n_bytes=1700, priority=9500,dl_type=0x88cc actions=CONTROLLER:65535 cookie=0x0, duration=7.747s, table=0, n_packets=0, n_bytes=0, priority=9000,mpls,mpls_label=494630,mpls_bos=1 actions=pop_mpls:0x0800,output:1 cookie=0x0, duration=7.746s, table=0, n_packets=0, n_bytes=0, priority=9000,ip,nw_src=10.0.0.3,nw_dst=10.0.0.1 actions=push_mpls:0x8847,set_field:337082->mpls_label,output:2
The shortest path, s1-s2a-s3, is chosen.
  1. Let's test path failover by removing switch s2a:
mininet@mininet-vm:~$  sudo ovs-vsctl del-br s2a 

mininet@mininet-vm:~$ sudo ovs-ofctl -O OpenFlow13 dump-flows s1
OFPST_FLOW reply (OF1.3) (xid=0x2):cookie=0x2, duration=96.839s, table=0, n_packets=0, n_bytes=0, priority=10000,arp actions=CONTROLLER:65535,NORMAL cookie=0x2, duration=96.827s, table=0, n_packets=20, n_bytes=1700, priority=9500,dl_type=0x88cc actions=CONTROLLER:65535 cookie=0x0, duration=7.739s, table=0, n_packets=0, n_bytes=0, priority=9000,ip,nw_src=10.0.0.1,nw_dst=10.0.0.3 actions=push_mpls:0x8847,set_field:494630->mpls_label,output:2 cookie=0x0, duration=7.724s, table=0, n_packets=0, n_bytes=0, priority=9000,mpls,mpls_label=337082,mpls_bos=1 actions=pop_mpls:0x0800,output:1

mininet@mininet-vm:~$ sudo ovs-ofctl -O OpenFlow13 dump-flows s2a
ovs-ofctl: s2a is not a bridge or a socket

mininet@mininet-vm:~$ sudo ovs-ofctl -O OpenFlow13 dump-flows s2b
OFPST_FLOW reply (OF1.3) (xid=0x2):cookie=0x3, duration=95.968s, table=0, n_packets=0, n_bytes=0, priority=10000,arp actions=CONTROLLER:65535,NORMAL cookie=0x3, duration=89.545s, table=0, n_packets=37, n_bytes=3145, priority=9500,dl_type=0x88cc actions=CONTROLLER:65535 cookie=0x0, duration=7.747s, table=0, n_packets=0, n_bytes=0, priority=9000,mpls,mpls_label=494630,mpls_bos=1 actions=output:3 cookie=0x0, duration=7.736s, table=0, n_packets=0, n_bytes=0, priority=9000,mpls,mpls_label=337082,mpls_bos=1 actions=output:2

mininet@mininet-vm:~$ sudo ovs-ofctl -O OpenFlow13 dump-flows s2c
OFPST_FLOW reply (OF1.3) (xid=0x2):cookie=0x3, duration=95.968s, table=0, n_packets=0, n_bytes=0, priority=10000,arp actions=CONTROLLER:65535,NORMAL cookie=0x3, duration=89.545s, table=0, n_packets=37, n_bytes=3145, priority=9500,dl_type=0x88cc actions=CONTROLLER:65535 cookie=0x0, duration=7.747s, table=0, n_packets=0, n_bytes=0, priority=9000,mpls,mpls_label=494630,mpls_bos=1 actions=output:3 cookie=0x0, duration=7.736s, table=0, n_packets=0, n_bytes=0, priority=9000,mpls,mpls_label=337082,mpls_bos=1 actions=output:2

mininet@mininet-vm:~$ sudo ovs-ofctl -O OpenFlow13 dump-flows s3
OFPST_FLOW reply (OF1.3) (xid=0x2): cookie=0x1, duration=97.781s, table=0, n_packets=0, n_bytes=0, priority=10000,arp actions=CONTROLLER:65535,NORMAL cookie=0x1, duration=97.778s, table=0, n_packets=20, n_bytes=1700, priority=9500,dl_type=0x88cc actions=CONTROLLER:65535 cookie=0x0, duration=7.747s, table=0, n_packets=0, n_bytes=0, priority=9000,mpls,mpls_label=494630,mpls_bos=1 actions=pop_mpls:0x0800,output:1 cookie=0x0, duration=7.746s, table=0, n_packets=0, n_bytes=0, priority=9000,ip,nw_src=10.0.0.3,nw_dst=10.0.0.1 actions=push_mpls:0x8847,set_field:337082->mpls_label,output:2
The forward flows are now pushed to switches s2b and s2c.
主站蜘蛛池模板: 威海市| 灌南县| 汉沽区| 灌云县| 呼图壁县| 邢台市| 甘南县| 内江市| 西安市| 兴仁县| 宽城| 承德县| 凉城县| 沙河市| 萍乡市| 壤塘县| 江油市| 延寿县| 祁门县| 丰顺县| 卢湾区| 华宁县| 远安县| 威信县| 闵行区| 兴国县| 桓台县| 沾益县| 海城市| 东丰县| 增城市| 宣汉县| 仪征市| 东山县| 加查县| 巴林左旗| 大余县| 新余市| 郧西县| 蕉岭县| 枝江市|