-
Notifications
You must be signed in to change notification settings - Fork 1k
integrate trex traffic generator into virtual testbed #6954
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,134 @@ | ||
| {% set host = configuration[hostname] %} | ||
| {% set mgmt_ip = ansible_host %} | ||
| {% if vm_type is defined and vm_type == "ceos" %} | ||
| {% set mgmt_if_index = 0 %} | ||
| {% else %} | ||
| {% set mgmt_if_index = 1 %} | ||
| {% endif %} | ||
| no schedule tech-support | ||
| ! | ||
| {% if vm_type is defined and vm_type == "ceos" %} | ||
| agent LicenseManager shutdown | ||
| agent PowerFuse shutdown | ||
| agent PowerManager shutdown | ||
| agent Thermostat shutdown | ||
| agent LedPolicy shutdown | ||
| agent StandbyCpld shutdown | ||
| agent Bfd shutdown | ||
| {% endif %} | ||
| ! | ||
| hostname {{ hostname }} | ||
| ! | ||
| vrf definition MGMT | ||
| rd 1:1 | ||
| ! | ||
| spanning-tree mode mstp | ||
| ! | ||
| aaa root secret 0 123456 | ||
| ! | ||
| username admin privilege 15 role network-admin secret 0 123456 | ||
| ! | ||
| clock timezone UTC | ||
| ! | ||
| lldp run | ||
| lldp management-address Management{{ mgmt_if_index }} | ||
| lldp management-address vrf MGMT | ||
| ! | ||
| snmp-server community {{ snmp_rocommunity }} ro | ||
| snmp-server vrf MGMT | ||
| ! | ||
| ip routing | ||
| ip routing vrf MGMT | ||
| ipv6 unicast-routing | ||
| ! | ||
| {% if vm_mgmt_gw is defined %} | ||
| ip route vrf MGMT 0.0.0.0/0 {{ vm_mgmt_gw }} | ||
| {% else %} | ||
| ip route vrf MGMT 0.0.0.0/0 {{ mgmt_gw }} | ||
| {% endif %} | ||
| ! | ||
| interface Management {{ mgmt_if_index }} | ||
| description TO LAB MGMT SWITCH | ||
| {% if vm_type is defined and vm_type == "ceos" %} | ||
| vrf MGMT | ||
| {% else %} | ||
| vrf forwarding MGMT | ||
| {% endif %} | ||
| ip address {{ mgmt_ip }}/{{ mgmt_prefixlen }} | ||
| no shutdown | ||
| ! | ||
| {% for name, iface in host['interfaces'].items() %} | ||
| interface {{ name }} | ||
| {% if name.startswith('Loopback') %} | ||
| description LOOPBACK | ||
| {% else %} | ||
| mtu 9214 | ||
| no switchport | ||
| no shutdown | ||
| {% endif %} | ||
| {% if name.startswith('Port-Channel') %} | ||
| port-channel min-links 1 | ||
| {% endif %} | ||
| {% if iface['lacp'] is defined %} | ||
| channel-group {{ iface['lacp'] }} mode active | ||
| lacp rate normal | ||
| {% endif %} | ||
| {% if iface['ipv4'] is defined %} | ||
| ip address {{ iface['ipv4'] }} | ||
| {% endif %} | ||
| {% if iface['ipv6'] is defined %} | ||
| ipv6 enable | ||
| ipv6 address {{ iface['ipv6'] }} | ||
| ipv6 nd ra suppress | ||
| {% endif %} | ||
| no shutdown | ||
| ! | ||
| {% endfor %} | ||
| ! | ||
| {% if hostname == "ARISTA01T1" %} | ||
| interface Ethernet4 | ||
| mtu 9214 | ||
| no switchport | ||
| ip address 202.1.1.3/24 | ||
| ! | ||
| ip route 48.0.0.0/8 10.0.0.56 | ||
| ip route 16.0.0.0/8 202.1.1.2 | ||
| {% else %} | ||
| interface Ethernet4 | ||
| mtu 9214 | ||
| no switchport | ||
| ip address 202.2.1.3/24 | ||
| ! | ||
| ip route 48.0.0.0/8 202.2.1.2 | ||
| ip route 16.0.0.0/8 10.0.0.58 | ||
| {% endif %} | ||
| ! | ||
| interface {{ bp_ifname }} | ||
| description backplane | ||
| no switchport | ||
| no shutdown | ||
| {% if host['bp_interface']['ipv4'] is defined %} | ||
| ip address {{ host['bp_interface']['ipv4'] }} | ||
| {% endif %} | ||
| {% if host['bp_interface']['ipv6'] is defined %} | ||
| ipv6 enable | ||
| ipv6 address {{ host['bp_interface']['ipv6'] }} | ||
| ipv6 nd ra suppress | ||
| {% endif %} | ||
| no shutdown | ||
| ! | ||
| {% for name, iface in host['interfaces'].items() if name.startswith('Loopback') %} | ||
| {% if iface['ipv4'] is defined %} | ||
| network {{ iface['ipv4'] }} | ||
| {% endif %} | ||
| {% if iface['ipv6'] is defined %} | ||
| network {{ iface['ipv6'] }} | ||
| {% endif %} | ||
| {% endfor %} | ||
| ! | ||
| management api http-commands | ||
| no protocol https | ||
| protocol http | ||
| no shutdown | ||
| ! | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
|
|
||
| - name: Start Trex traffic generator container | ||
| block: | ||
| - name: Pull trex image | ||
| command: docker pull trexcisco/trex | ||
| become: yes | ||
|
|
||
| - name: Stop existence trex container | ||
| command: "{{ item }}" | ||
| with_items: | ||
| - docker stop trex | ||
| - docker rm trex | ||
| become: yes | ||
| ignore_errors: true | ||
|
|
||
| - name: Start trex traffic generator container | ||
| command: docker run --name trex -it -d --privileged --cap-add=ALL trexcisco/trex | ||
| become: yes | ||
|
|
||
| - name: Untar trex client | ||
| command: docker exec trex bash -c "cd /var/trex/v2.41/ ; tar zxf trex_client_v2.41.tar.gz" | ||
| become: yes | ||
|
|
||
| - name: Prepare trex runtime files | ||
| command: "{{ item }}" | ||
| with_items: | ||
| - docker exec trex bash -c "cd /var/trex/v2.41/ ; tar zxf trex_client_v2.41.tar.gz" | ||
| - docker cp {{inventory_dir}}/../tests/wan/trex/imix.py trex:/var/trex/v2.41/trex_client/stl/profiles/ | ||
| - docker cp {{inventory_dir}}/../tests/wan/trex/trex_cfg.yaml trex:/etc/ | ||
| - docker cp {{inventory_dir}}/../tests/wan/trex/stl_path.py trex:/var/trex/v2.41/trex_client/stl/examples | ||
| - docker cp {{inventory_dir}}/../tests/wan/trex/stl_imix.py trex:/var/trex/v2.41/trex_client/stl/examples | ||
| delegate_to: localhost | ||
| become: yes | ||
|
|
||
| - name: Remove VM interface from ovs bridge | ||
| command: "{{ item }}" | ||
| with_items: | ||
| - ovs-vsctl del-port br-VM0100-3 VM0100-t3 | ||
| - ovs-vsctl del-port br-VM0101-3 VM0101-t3 | ||
| ignore_errors: yes | ||
| become: yes | ||
|
|
||
| - name: Remove trex bridge | ||
| command: "{{ item }}" | ||
| with_items: | ||
| - ifconfig trex-in down | ||
| - ifconfig trex-out down | ||
| - brctl delbr trex-in | ||
| - brctl delbr trex-out | ||
| ignore_errors: yes | ||
| become: yes | ||
|
|
||
| - name: Create trex network | ||
| command: "{{ item }}" | ||
| with_items: | ||
| - brctl addbr trex-in | ||
| - ifconfig trex-in up | ||
| - brctl addbr trex-out | ||
| - ifconfig trex-out up | ||
| - ip link add trex-intf-1 type veth peer trex-intf-br-1 | ||
| - ip link add trex-intf-2 type veth peer trex-intf-br-2 | ||
| - ifconfig trex-intf-br-1 up | ||
| - ifconfig trex-intf-br-2 up | ||
| - brctl addif trex-in trex-intf-br-1 | ||
| - brctl addif trex-in VM0100-t3 | ||
| - brctl addif trex-out trex-intf-br-2 | ||
| - brctl addif trex-out VM0101-t3 | ||
| ignore_errors: yes | ||
| become: yes | ||
|
|
||
| - name: Add interface to Trex container | ||
| shell: | | ||
| docker inspect trex|grep -w "Pid"| awk '{print $2}'|rev|cut -c2-|rev|xargs ip link set trex-intf-1 netns | ||
| docker inspect trex|grep -w "Pid"| awk '{print $2}'|rev|cut -c2-|rev|xargs ip link set trex-intf-2 netns | ||
| docker exec trex bash -c "ifconfig trex-intf-1 202.1.1.2/24 up" | ||
| docker exec trex bash -c "ifconfig trex-intf-2 202.2.1.2/24 up" | ||
| ignore_errors: yes | ||
| become: yes | ||
|
|
||
|
|
||
| - name: Start Trex traffic generator server | ||
| command: docker exec trex bash -c "cd /var/trex/v2.41/ ; ./t-rex-64 -i >/dev/null &" | ||
| become: yes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| topology: | ||
| topo_type: wan | ||
| VMs: | ||
| ARISTA01T1: | ||
| vlans: | ||
| - 0 | ||
| - 1 | ||
| - 2 | ||
| vm_offset: 0 | ||
| ARISTA02T1: | ||
| vlans: | ||
| - 10 | ||
| - 11 | ||
| - 12 | ||
| vm_offset: 1 | ||
| DUT: | ||
| loopback: | ||
| ipv4: | ||
| - 10.1.0.32/32 | ||
| ipv6: | ||
| - FC00:1::32/128 | ||
| wan_dut_configuration: | ||
| WANDUT01: | ||
| interfaces: | ||
| PortChannel101: | ||
| intfs: [0, 1, 2] | ||
| ipv4: 10.0.0.56/31 | ||
| ipv6: FC00::71/126 | ||
| PortChannel102: | ||
| intfs: [10, 11, 12] | ||
| ipv4: 10.0.0.58/31 | ||
| ipv6: FC00::75/126 | ||
| dut_offset: 0 | ||
| configuration_properties: | ||
| common: | ||
| dut_asn: 65100 | ||
| dut_type: Router | ||
| swrole: core | ||
| configuration: | ||
| ARISTA01T1: | ||
| properties: | ||
| - common | ||
| bgp: | ||
| asn: 64600 | ||
| peers: | ||
| 65100: | ||
| - 10.0.0.56 | ||
| - FC00::71 | ||
| interfaces: | ||
| Loopback0: | ||
| ipv4: 100.1.0.29/32 | ||
| ipv6: 2064:100::1d/128 | ||
| Ethernet1: | ||
| lacp: 1 | ||
| Ethernet2: | ||
| lacp: 1 | ||
| Ethernet3: | ||
| lacp: 1 | ||
| Port-Channel1: | ||
| ipv4: 10.0.0.57/31 | ||
| ipv6: fc00::72/126 | ||
| bp_interface: | ||
| ipv4: 10.10.246.29/24 | ||
| ipv6: fc0a::1d/64 | ||
| ARISTA02T1: | ||
| properties: | ||
| - common | ||
| bgp: | ||
| asn: 64600 | ||
| peers: | ||
| 65100: | ||
| - 10.0.0.58 | ||
| - FC00::75 | ||
| interfaces: | ||
| Loopback0: | ||
| ipv4: 100.1.0.30/32 | ||
| ipv6: 2064:100::1e/128 | ||
| Ethernet1: | ||
| lacp: 1 | ||
| Ethernet2: | ||
| lacp: 1 | ||
| Ethernet3: | ||
| lacp: 1 | ||
| Port-Channel1: | ||
| ipv4: 10.0.0.59/31 | ||
| ipv6: fc00::76/126 | ||
| bp_interface: | ||
| ipv4: 10.10.246.30/24 | ||
| ipv6: fc0a::1e/64 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,6 +36,7 @@ all: | |
| - wan-4link | ||
| - wan-pub-cisco | ||
| - wan-2dut | ||
| - wan-3link-tg | ||
| children: | ||
| server_1: | ||
| lab: | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.