#include <LinkDiscoveryModuleTests.h>
|
| | LinkDiscoveryModuleTests () |
| |
| void | setUp () |
| |
| void | tearDown () |
| |
| void | fullSetupRegistryStart () |
| |
| void | partialSetupRegistryStart () |
| |
| void | eventOnlySetupRegistryStart () |
| |
| bool | containsMapLink (std::map< std::uint64_t, std::map< uint32_t, std::pair< uint64_t, uint32_t >>> &toValid, uint64_t source, uint32_t sPort, uint64_t endpoint, uint32_t ePort) |
| |
| bool | validateContainsAllFrom (std::map< std::uint64_t, std::map< uint32_t, std::pair< uint64_t, uint32_t >>> toValid, std::uint64_t source) |
| |
| bool | validateContainsAllTo (std::map< std::uint64_t, std::map< uint32_t, std::pair< uint64_t, uint32_t >>> toValid, std::uint64_t endpoint) |
| |
| bool | validateContainsAllBetwenn (std::map< std::uint64_t, std::map< uint32_t, std::pair< uint64_t, uint32_t >>> toValid, std::uint64_t source, std::uint64_t endpoint) |
| |
| void | testRequestNormalGetAllLinks () |
| |
| void | testRequestNormalGetAllLinksPartialEvent () |
| |
| void | testRequestNormalGetAllLinksFullEvent () |
| |
| void | testRequestNormalWithChangesGetAllLinks () |
| |
| void | testRequestCorruptedProtoGetAllLinks () |
| |
| void | testRequestNormalGetLinksFromSwitch () |
| |
| void | testRequestNormalGetLinksFromSwitchPartialEvent () |
| |
| void | testRequestNormalGetLinksFromSwitchFullEvent () |
| |
| void | testRequestNormalWithChangesGetLinksFromSwitch () |
| |
| void | testRequestCorrptedGetLinksFromSwitch () |
| |
| void | testRequestWrongIdGetLinkgsFromSwitch () |
| |
| void | testRequestNormalGetLinksToSwitch () |
| |
| void | testRequestNormalGetLinksToSwitchPartialEvent () |
| |
| void | testRequestNormalGetLinksToSwitchFullEvent () |
| |
| void | testRequestNormalWithChangesGetLinksToSwitch () |
| |
| void | testRequestCorrptedGetLinksToSwitch () |
| |
| void | testRequestWrongIdGetLinksToSwitch () |
| |
| void | testRequestNormalAllLinksOfSwitch () |
| |
| void | testRequestNormalAllLinksOfSwitchPartialEvent () |
| |
| void | testRequestNormalAllLinksOfSwitchFullEvent () |
| |
| void | testRequestNormalWithChangesAllLinksOfSwitch () |
| |
| void | testRequestCorrptedAllLinksOfSwitch () |
| |
| void | testRequestWrongIdAllLinksOfSwitch () |
| |
| void | testRequestNormalLinksBetweenTwoSwitches () |
| |
| void | testRequestNormalLinksBetweenTwoSwitchesPartialEvent () |
| |
| void | testRequestNormalLinksBetweenTwoSwitchesFullEvent () |
| |
| void | testRequestNormalWithChangesLinksBetweenTwoSwitches () |
| |
| void | testRequestCorrptedLinksBetweenTwoSwitches () |
| |
| void | testRequestWrongIdLinksBetweenTwoSwitches () |
| |
Unit-Test class which contains all needed state behavior elements and function tests to ensure correct behavior of the LinkDiscoveryModule. Each test follows a similar sequence of action. 1) Setup the state of the test environment (Setup) 2) Start the LinkDiscoveryModule 3) Make some changes to the environment 4) Request the state of the LinkDiscoveryModule 5) Validate the result 6) Clean up the test environment (TearDown)
- Author
- Matthias Strljic
| LinkDiscoveryModuleTests::LinkDiscoveryModuleTests |
( |
| ) |
|
| bool LinkDiscoveryModuleTests::containsMapLink |
( |
std::map< std::uint64_t, std::map< uint32_t, std::pair< uint64_t, uint32_t >>> & |
toValid, |
|
|
uint64_t |
source, |
|
|
uint32_t |
sPort, |
|
|
uint64_t |
endpoint, |
|
|
uint32_t |
ePort |
|
) |
| |
Evaluate if the to given map contains the link described by the 4 params source, sPort, endpoint, ePort
- Parameters
-
| toValid | reference to a map which contains a representation of links between switches |
| source | ID of the switch at the beginning of a link. |
| sPort | the port of the source switch with which it is connected to the link. |
| endpoint | ID of the switch ath the end of a link |
| ePort | the port of the endpoint switch with which it is conntected to the link. |
| void LinkDiscoveryModuleTests::eventOnlySetupRegistryStart |
( |
| ) |
|
Encapsulated setup method like the fullSetupRegistryStart method with a known set of 0.
| void LinkDiscoveryModuleTests::fullSetupRegistryStart |
( |
| ) |
|
Encapsulated setup method to initialize the switches and the registry at the beginning of a test, so that the registry will hold all available switches for the test at it's beginning. This is used to get scenario in which all switches are known at the "GetAllSwitches" request from the LinkDiscoveryModule to the SwitchRegistryModule instance.
| void LinkDiscoveryModuleTests::partialSetupRegistryStart |
( |
| ) |
|
Encapsulated setup method to initialize the switches and the registry at the beginning of a test, so that the registry will hold half of the available switches for the test at it's beginning and will publish the other half after it receives the "GetAllSwitches" request from the LinkDiscoveryModule. This is used to get scenario in which a part of the switches are not known at the "GetAllSwitches" request from the LinkDiscoveryModule to the SwitchRegistryModule instance.
| void LinkDiscoveryModuleTests::setUp |
( |
| ) |
|
Setup at the beginning of each single unit test. This will start all simulated switch adapters, switch registry, the tester and linkdiscovery modules.
| void LinkDiscoveryModuleTests::tearDown |
( |
| ) |
|
Releases all resources of the test at it's end, to get a clean setup at the next test case. This method will take some time, cause it will waite until all modules are disabled.
| void LinkDiscoveryModuleTests::testRequestCorrptedAllLinksOfSwitch |
( |
| ) |
|
Send corrupted / invalid message to test the stability of the GetAllLinksOfSwitch request logic.
| void LinkDiscoveryModuleTests::testRequestCorrptedGetLinksFromSwitch |
( |
| ) |
|
Send corrupted / invalid message to test the stability of the GetAllLinksFromSwitch request logic.
| void LinkDiscoveryModuleTests::testRequestCorrptedGetLinksToSwitch |
( |
| ) |
|
Send corrupted / invalid message to test the stability of the GetAllLinksToSwitch request logic.
| void LinkDiscoveryModuleTests::testRequestCorrptedLinksBetweenTwoSwitches |
( |
| ) |
|
Send corrupted / invalid message to test the stability of the GetAllLinksBetweenSwitches request logic.
| void LinkDiscoveryModuleTests::testRequestCorruptedProtoGetAllLinks |
( |
| ) |
|
Send corrupted / invalid message to test the stability of the GetAllLinks request logic.
| void LinkDiscoveryModuleTests::testRequestNormalAllLinksOfSwitch |
( |
| ) |
|
Normal request scenario to get all existing links of a particular switch, with full setup. This inlcudes all link "from" and "to" a switch. Sequence: FullSetup -> start LinkDiscovery -> start TestModule -> waite -> request all links of switch -> compare result -> tearDown
| void LinkDiscoveryModuleTests::testRequestNormalAllLinksOfSwitchFullEvent |
( |
| ) |
|
Normal request scenario to get all existing links of a particular switch, with event only setup. This inlcudes all link "from" and "to" a switch. Sequence: EventOnlySetup -> start LinkDiscovery -> waite -> start TestModule -> waite -> request all links of switch -> compare result -> tearDown
| void LinkDiscoveryModuleTests::testRequestNormalAllLinksOfSwitchPartialEvent |
( |
| ) |
|
Normal request scenario to get all existing links of a particular switch, with partial setup. This inlcudes all link "from" and "to" a switch. Sequence: PartialSetup -> start LinkDiscovery -> waite -> start TestModule -> waite -> request all links of switch -> compare result -> tearDown
| void LinkDiscoveryModuleTests::testRequestNormalGetAllLinks |
( |
| ) |
|
Normal request scenario to get all existing links, with full setup. Sequence: FullSetup -> start LinkDiscovery -> start TestModule -> waite -> request all Links -> compare result -> tearDown
| void LinkDiscoveryModuleTests::testRequestNormalGetAllLinksFullEvent |
( |
| ) |
|
Normal request scenario to get all existing links, with event only setup. Sequence: EventOnlySetup -> start LinkDiscovery -> waite -> start TestModule -> waite -> request all Links -> compare result -> tearDown
| void LinkDiscoveryModuleTests::testRequestNormalGetAllLinksPartialEvent |
( |
| ) |
|
Normal request scenario to get all existing links, with partial setup. Sequence: PartialSetup -> start LinkDiscovery -> waite -> start TestModule -> waite -> request all Links -> compare result -> tearDown
| void LinkDiscoveryModuleTests::testRequestNormalGetLinksFromSwitch |
( |
| ) |
|
Normal request scenario to get all existing links from a particular switch, with full setup. Sequence: FullSetup -> start LinkDiscovery -> start TestModule -> waite -> request all from links -> compare result -> tearDown
| void LinkDiscoveryModuleTests::testRequestNormalGetLinksFromSwitchFullEvent |
( |
| ) |
|
Normal request scenario to get all existing links from a particular switch, with event only setup. Sequence: EventOnlySetup -> start LinkDiscovery -> waite -> start TestModule -> waite -> request all with links -> compare result -> tearDown
| void LinkDiscoveryModuleTests::testRequestNormalGetLinksFromSwitchPartialEvent |
( |
| ) |
|
Normal request scenario to get all existing links from a particular switch, with partial setup. Sequence: PartialSetup -> start LinkDiscovery -> waite -> start TestModule -> waite -> request all from links -> compare result -> tearDown
| void LinkDiscoveryModuleTests::testRequestNormalGetLinksToSwitch |
( |
| ) |
|
Normal request scenario to get all existing links to a particular switch, with full setup. Sequence: FullSetup -> start LinkDiscovery -> start TestModule -> waite -> request all links to switch -> compare result -> tearDown
| void LinkDiscoveryModuleTests::testRequestNormalGetLinksToSwitchFullEvent |
( |
| ) |
|
Normal request scenario to get all existing links to a particular switch, with event only setup. Sequence: EventOnlySetup -> start LinkDiscovery -> waite -> start TestModule -> waite -> request all links to switch -> compare result -> tearDown
| void LinkDiscoveryModuleTests::testRequestNormalGetLinksToSwitchPartialEvent |
( |
| ) |
|
Normal request scenario to get all existing links to a particular switch, with partial setup. Sequence: PartialSetup -> start LinkDiscovery -> waite -> start TestModule -> waite -> request all links to switch -> compare result -> tearDown
| void LinkDiscoveryModuleTests::testRequestNormalLinksBetweenTwoSwitches |
( |
| ) |
|
Normal request scenario to get all existing links between two switches, with full setup. This case will loop over all posible combinations to find false-positives and false-negative links. Sequence: FullSetup -> start LinkDiscovery -> start TestModule -> waite -> LOOP[ALL_SWITCH_COMBINATIONS]{ request all links between two switches -> compare result } -> tearDown
| void LinkDiscoveryModuleTests::testRequestNormalLinksBetweenTwoSwitchesFullEvent |
( |
| ) |
|
Normal request scenario to get all existing links between two switches, with event only setup. This case will loop over all posible combinations to find false-positives and false-negative links. Sequence: EventOnlySetup -> start LinkDiscovery -> waite -> start TestModule -> waite -> LOOP[ALL_SWITCH_COMBINATIONS]{ request all links between two switches -> compare result } -> tearDown
| void LinkDiscoveryModuleTests::testRequestNormalLinksBetweenTwoSwitchesPartialEvent |
( |
| ) |
|
Normal request scenario to get all existing links between two switches, with partial setup. This case will loop over all posible combinations to find false-positives and false-negative links. Sequence: PartialSetup -> start LinkDiscovery -> waite -> start TestModule -> waite -> LOOP[ALL_SWITCH_COMBINATIONS]{ request all links between two switches -> compare result } -> tearDown
| void LinkDiscoveryModuleTests::testRequestNormalWithChangesAllLinksOfSwitch |
( |
| ) |
|
Normal request scenario to get all existing links of a particular switch, with full setup with additional remove and add switch events to test the correct behavior belong to these changes. This inlcudes all link "from" and "to" a switch. Sequence: FullSetup -> start LinkDiscovery -> waite -> start TestModule -> waite -> remove switch with links -> add switch with links -> waite -> request all links of switch -> compare result -> tearDown
| void LinkDiscoveryModuleTests::testRequestNormalWithChangesGetAllLinks |
( |
| ) |
|
Normal request scenario to get all existing links, with full setup with additional remove and add switch events. Sequence: FullSetup -> start LinkDiscovery -> waite -> start TestModule -> waite -> remove switch with links -> add switch with links -> waite -> request all Links -> compare result -> tearDown
| void LinkDiscoveryModuleTests::testRequestNormalWithChangesGetLinksFromSwitch |
( |
| ) |
|
Normal request scenario to get all existing links from a particular switch, with full setup with additional remove and add switch events to test the correct behavior belong to these changes. Sequence: FullSetup -> start LinkDiscovery -> waite -> start TestModule -> waite -> remove switch with links -> add switch with links -> waite -> request all from links -> compare result -> tearDown
| void LinkDiscoveryModuleTests::testRequestNormalWithChangesGetLinksToSwitch |
( |
| ) |
|
Normal request scenario to get all existing links to a particular switch, with full setup with additional remove and add switch events to test the correct behavior belong to these changes. Sequence: FullSetup -> start LinkDiscovery -> waite -> start TestModule -> waite -> remove switch with links -> add switch with links -> waite -> request all links to switch -> compare result -> tearDown
| void LinkDiscoveryModuleTests::testRequestNormalWithChangesLinksBetweenTwoSwitches |
( |
| ) |
|
Normal request scenario to get all existing links between two switches, with full setup with additional remove and add switch events to test the correct behavior belong to these changes. This case will loop over all posible combinations to find false-positives and false-negative links. Sequence: FullSetup -> start LinkDiscovery -> waite -> start TestModule -> waite -> remove switch with links -> add switch with links -> waite -> LOOP[ALL_SWITCH_COMBINATIONS]{ request all links between two switches -> compare result } -> tearDown
| void LinkDiscoveryModuleTests::testRequestWrongIdAllLinksOfSwitch |
( |
| ) |
|
Tests the simple scenario of requesting "of" links of a non existing switch. This inlcudes all link "from" and "to" a switch.
| void LinkDiscoveryModuleTests::testRequestWrongIdGetLinkgsFromSwitch |
( |
| ) |
|
Tests the simple scenario of requesting from links of a non existing switch.
| void LinkDiscoveryModuleTests::testRequestWrongIdGetLinksToSwitch |
( |
| ) |
|
Tests the simple scenario of requesting "to" links of a non existing switch.
| void LinkDiscoveryModuleTests::testRequestWrongIdLinksBetweenTwoSwitches |
( |
| ) |
|
Tests the simple scenario of requestin links between two switches in 3 cases. 1) source switch does not exist 2) endpoint switch does not exist 3) both switches does not exist
| bool LinkDiscoveryModuleTests::validateContainsAllBetwenn |
( |
std::map< std::uint64_t, std::map< uint32_t, std::pair< uint64_t, uint32_t >>> |
toValid, |
|
|
std::uint64_t |
source, |
|
|
std::uint64_t |
endpoint |
|
) |
| |
Evalutaion method to check if the toValid link map contains all existing links between a source and a endpoint switch.
- Parameters
-
| toValid | link map which should be evaluated. |
| source | ID of the source switch. |
| endpoint | ID of the source switch. |
| bool LinkDiscoveryModuleTests::validateContainsAllFrom |
( |
std::map< std::uint64_t, std::map< uint32_t, std::pair< uint64_t, uint32_t >>> |
toValid, |
|
|
std::uint64_t |
source |
|
) |
| |
Evalutaion method to check if the toValid link map contains all existing links from the source switch with the given switch ID.
- Parameters
-
| toValid | link map which should be evaluated. |
| source | ID of the source switch. |
| bool LinkDiscoveryModuleTests::validateContainsAllTo |
( |
std::map< std::uint64_t, std::map< uint32_t, std::pair< uint64_t, uint32_t >>> |
toValid, |
|
|
std::uint64_t |
endpoint |
|
) |
| |
Evalutaion method to check if the toValid link map contains all existing links to the endpoint switch with the given switch ID.
- Parameters
-
| toValid | link map which should be evaluated. |
| endpoint | ID of the source switch. |
The documentation for this class was generated from the following files: