In the next steps, you will create test cases that verify that OSPF neighbors are up on the IOS-XE, IOS-XR, and NXOS devices in your testbed.
From your test case Job File page:
*** Settings ***
Library CXTA
Resource cxta.robot
Library Collections
Suite Setup Run Keywords
... load testbed
Suite Teardown Run Keywords
... disconnect from all devices
*** Test Cases ***
1. Connect to Devices
FOR ${DEVICE} IN @{DEVICES}
${status}= Run Keyword And Ignore Error connect to device "${DEVICE}"
IF '${status[0]}' == 'FAIL'
Fail ++UNSUCCESSFUL++ ${DEVICE} not connected
ELSE
set test message ++SUCCESSFUL++ ${DEVICE} connected \n append=True
END
END
2. Verify OSPF Neighbor State
FOR ${DEVICE} IN @{DEVICES}
${output}= parse "show ip ospf neighbor" on device "${DEVICE}"
@{interfaces}= Get Dictionary Keys ${output['interfaces']}
FOR ${interface} IN @{interfaces}
@{neighbors}= Get Dictionary Keys ${output['interfaces']['${interface}']['neighbors']}
FOR ${neighbor} IN @{neighbors}
${state}= Get From Dictionary ${output['interfaces']['${interface}']['neighbors']['${neighbor}']} state
${status}= Run Keyword and Return Status should be true '${EXPECTED_STATE}' in '${state}'
IF '${status}' == 'False'
Fail ++UNSUCCESSFUL++ neighbor ${neighbor} state on ${DEVICE} is not '${EXPECTED_STATE}'
ELSE
set test message ++SUCCESSFUL++ neighbor ${neighbor} state on ${DEVICE} is '${EXPECTED_STATE}' \n append=True
END
END
END
END
NOTE: You may need to scroll down to see the Parameter File section.
DEVICES:
- CSR1Kv-01
EXPECTED_STATE: FULL
From your test case Job File page:
*** Settings ***
# CXTA
Library CXTA
Resource cxta.robot
Suite Setup Run Keywords
... load testbed
Suite Teardown Run Keywords
... Disconnect From All Devices
*** Test Cases ***
Connect to device via NETCONF
[Documentation] Connect to device(s) under test via NETCONF connection.
set netconf timeout to "180" seconds
${status}= Run Keyword And Ignore Error connect to device "${DEVICE}" via netconf using alias "nc1"
IF '${status[0]}' == 'FAIL'
Fail ++UNSUCCESSFUL++ ${DEVICE} not connected
ELSE
Set Test Message ++SUCCESSFUL++ ${DEVICE} connected \n append=True
END
Verify Device OSPF Neighbors State via NETCONF Get Operation
[Documentation] Verify OSPF neighbors are in expected state via NETCONF.
${output} ${dict}= netconf get filter_type=subtree filter=${RPC_FILTER} reply_dict=${true} device=${DEVICE} alias=nc1
Log ${output}
Log ${dict}
${ospf_neighbor_list}= Set Variable ${dict['rpc-reply']['data']['ospf']['processes']['process']['default-vrf']['adjacency-information']['neighbors']['neighbor']}
FOR ${ospf_neighbor} IN @{ospf_neighbor_list}
${status}= Run Keyword and Return Status Should Be Equal As Strings ${EXPECTED_STATE} ${ospf_neighbor['neighbor-state']}
IF ${status}
Set Test Message ++SUCCESSFUL++ ${DEVICE} has OSPF neighbors in the expected ${EXPECTED_STATE} state\n append=True
ELSE
${ospf_neighbor_addr}= Set Variable ${ospf_neighbor['neighbor-address']}
Fail ++UNSUCCESSFUL++ Expected OSPF neighbor state was ${EXPECTED_STATE}, but ${DEVICE} has OSPF neighbor ${ospf_neighbor_addr} in the ${ospf_neighbor['neighbor-state'] state
END
END
NOTE: You may need to scroll down to see the Parameter File section.
DEVICE: XR9Kv-01
RPC_FILTER: |
<ospf xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-ipv4-ospf-oper">
<processes>
<process>
<default-vrf>
<adjacency-information>
<neighbors/>
</adjacency-information>
</default-vrf>
</process>
</processes>
</ospf>
EXPECTED_STATE: mgmt-nbr-full
From your test case Job File page:
*** Settings ***
Library CXTA
Resource cxta.robot
Library genie.libs.robot.GenieRobot
Library genie.libs.robot.GenieRobotApis
Suite Setup Run Keywords
... load testbed #load testbed file
Suite Teardown Run Keywords
... disconnect from all devices #disconnect from all devices
*** Test Cases ***
1. CONNECT TO DEVICE UNDER TEST (REST)
[Documentation] Connect to DUTs using rest connection.
${status}= Run Keyword And Ignore Error connect to device "${DEVICE}" via "rest"
IF '${status[0]}' == 'FAIL'
Fail ++UNSUCCESSFUL++ ${DEVICE} not connected
ELSE
set test message ++SUCCESSFUL++ ${DEVICE} connected \n append=True
END
2. VERIFY ALL CONFIGURED OSPF NEIGHBOR STATES ARE FULL FOR THE GIVEN DUT
[Documentation] Verify all ospf neighbors states.
${resp}= nxapi method nxapi cli device=${DEVICE} action=send commands=show ip ospf neighbors message_format=json_rpc command_type=cli alias=rest
FOR ${neighbor} IN ${resp.json()}[result][body][TABLE_ctx][ROW_ctx][TABLE_nbr]
VAR ${state} ${neighbor}[ROW_nbr][state]
VAR ${rid} ${neighbor}[ROW_nbr][rid]
IF '${state}' == '${EXPECTED_STATE}'
set test message ++SUCCESSFUL++ Neighbor ${rid} state is ${state} \n append=True
ELSE
Fail ++UNSUCCESSFUL++ Neighbor ${rid} state is ${state}
END
END
NOTE: You may need to scroll down to see the Parameter File section.
DEVICE: N9Kv-01
EXPECTED_STATE: FULL
From your project :
Continue to the next section to update the BGP test cases you imported earlier in the lab.