Skip to content
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

Add testing support for multiple flows. #30

Merged
merged 3 commits into from
Aug 22, 2023
Merged

Add testing support for multiple flows. #30

merged 3 commits into from
Aug 22, 2023

Conversation

robshakir
Copy link
Contributor

commit 028559c0047f904be4b41cf4fad03a11d115b1be
Author: Rob Shakir <[email protected]>
Date:   Mon Aug 21 22:45:30 2023 +0000

    Add testing for `flowCounters.clearStats`.

commit f6055a16916b5bbbbbb08b40d4d780e1fc6e2596
Author: Rob Shakir <[email protected]>
Date:   Mon Aug 21 22:31:55 2023 +0000

    Add tests covering multiple flows within the simple e2e test.
    
     * (M) e2e/simple_ondatra_test.go
       - Refactor to have more reusability.
       - Add test cases for multiple flows, and one that does not work.
     * (M) flows/mpls/mpls.go
       - Add support for resetting counters.
     * (M) kne/integration.testbed
       - Ensure that the wiring of the testbed is consistent.
     * (M) lwotg/flows(_test)?.go
       - Ensure that we do not accept >1 flow with the same name.

passing integration test results


I0821 22:34:44.171465   19076 topo.go:151] Trying in-cluster configuration
I0821 22:34:44.171513   19076 topo.go:154] Falling back to kubeconfig: "/usr/local/google/home/robjs/.kube/config"
I0821 22:34:44.172812   19076 topo.go:357] Adding Link: ate:eth1 mirror:eth1
I0821 22:34:44.172831   19076 topo.go:357] Adding Link: ate:eth2 mirror:eth2
I0821 22:34:44.172836   19076 topo.go:398] Adding Node: ate:OPENCONFIG
I0821 22:34:44.172875   19076 topo.go:398] Adding Node: mirror:HOST

*** Reserving the testbed...

I0821 22:34:44.173310   19076 topo.go:292] Topology:
name: "magna-integration"
nodes: {
  name: "ate"
  labels: {
    key: "ondatra-role"
    value: "ATE"
  }
  config: {
    command: "/app/magna"
    args: "-alsologtostderr"
    args: "-v=2"
    args: "-port=40051"
    args: "-telemetry_port=50051"
    args: "-certfile=/data/cert.pem"
    args: "-keyfile=/data/key.pem"
    image: "magna:latest"
    entry_command: "kubectl exec -it ate -- sh"
  }
  services: {
    key: 40051
    value: {
      name: "grpc"
      inside: 40051
    }
  }
  services: {
    key: 50051
    value: {
      name: "gnmi"
      inside: 50051
    }
  }
  vendor: OPENCONFIG
  model: "MAGNA"
  interfaces: {
    key: "eth1"
    value: {
      int_name: "eth1"
      peer_name: "mirror"
      peer_int_name: "eth1"
    }
  }
  interfaces: {
    key: "eth2"
    value: {
      int_name: "eth2"
      peer_name: "mirror"
      peer_int_name: "eth2"
      uid: 1
    }
  }
}
nodes: {
  name: "mirror"
  labels: {
    key: "ondatra-role"
    value: "DUT"
  }
  config: {
    command: "/app/mirror"
    command: "-alsologtostderr"
    image: "mirror:latest"
    entry_command: "kubectl exec -it mirror -- sh"
    config_path: "/etc"
    config_file: "config"
  }
  services: {
    key: 60051
    value: {
      name: "mirror-controller"
      inside: 60051
    }
  }
  vendor: HOST
  interfaces: {
    key: "eth1"
    value: {
      int_name: "eth1"
      peer_name: "ate"
      peer_int_name: "eth1"
    }
  }
  interfaces: {
    key: "eth2"
    value: {
      int_name: "eth2"
      peer_name: "ate"
      peer_int_name: "eth2"
      uid: 1
    }
  }
}
links: {
  a_node: "ate"
  a_int: "eth1"
  z_node: "mirror"
  z_int: "eth1"
}
links: {
  a_node: "ate"
  a_int: "eth2"
  z_node: "mirror"
  z_int: "eth2"
}
E0821 22:34:44.204576   19076 dut.go:271] Could not dial GNMI to dut mirror: service "gnmi" not found on DUT "mirror"
*** PROPERTY: build.path -> 
*** PROPERTY: build.main.version -> 
*** PROPERTY: git.origin -> [email protected]:openconfig/magna.git
*** PROPERTY: topology -> ate:2,mirror:2
*** PROPERTY: test.path -> e2e
*** PROPERTY: build.go_version -> go1.22-20230729-RC00 cl/552016856 +457721cd52 X:fieldtrack,boringcrypto
*** PROPERTY: build.main.path -> 
*** PROPERTY: build.main.sum -> 
*** PROPERTY: git.commit -> f6055a16916b5bbbbbb08b40d4d780e1fc6e2596
*** PROPERTY: git.commit_timestamp -> 1692657115
*** PROPERTY: git.status -> ?? foo

*** PROPERTY: git.clean -> false

********************************************************************************

  Testbed Reservation Complete
  ID: 1430f432-f9f9-4153-bbe0-d9a2d5323a94

    mirror:           mirror
    port1:            eth1
    port2:            eth2
    ate:              ate
    port1:            eth1
    port2:            eth2

********************************************************************************

=== RUN   TestMirror
--- PASS: TestMirror (1.00s)
=== RUN   TestMPLS
    simple_ondatra_test.go:68: 
        *** Creating new config for ate...
        
        
[WARNING]: PortName property in schema DeviceEthernet is deprecated, This property is deprecated in favor of property connection.port_name
[WARNING]: PortName property in schema DeviceEthernet is deprecated, This property is deprecated in favor of property connection.port_name
    simple_ondatra_test.go:80: configuration for OTG is {
          "ports": [
            {
              "name": "port1"
            },
            {
              "name": "port2"
            }
          ],
          "devices": [
            {
              "ethernets": [
                {
                  "port_name": "port1",
                  "mac": "02:00:01:01:01:01",
                  "mtu": 1500,
                  "name": "port1_ETH"
                }
              ],
              "name": "port1"
            },
            {
              "ethernets": [
                {
                  "port_name": "port2",
                  "mac": "02:00:02:01:01:01",
                  "mtu": 1500,
                  "name": "port2_ETH"
                }
              ],
              "name": "port2"
            }
          ]
        }
    simple_ondatra_test.go:82: 
        *** Pushing config to ate...
        
        
[WARNING]: PortName property in schema DeviceEthernet is deprecated, This property is deprecated in favor of property connection.port_name
[WARNING]: PortName property in schema DeviceEthernet is deprecated, This property is deprecated in favor of property connection.port_name
    simple_ondatra_test.go:229: 
        *** Pushing config to ate...
        
        
[WARNING]: PortName property in schema DeviceEthernet is deprecated, This property is deprecated in favor of property connection.port_name
[WARNING]: PortName property in schema DeviceEthernet is deprecated, This property is deprecated in favor of property connection.port_name
    simple_ondatra_test.go:231: Starting MPLS traffic...
    simple_ondatra_test.go:232: 
        *** Starting traffic on ate...
        
        
    simple_ondatra_test.go:233: Sleeping for 10s...
    simple_ondatra_test.go:235: Stopping MPLS traffic...
    simple_ondatra_test.go:236: 
        *** Stopping traffic on ate...
        
        
--- PASS: TestMPLS (14.06s)
=== RUN   TestMPLSFlows
=== RUN   TestMPLSFlows/two_flows_-_same_source_port
    simple_ondatra_test.go:68: 
        *** Creating new config for ate...
        
        
[WARNING]: PortName property in schema DeviceEthernet is deprecated, This property is deprecated in favor of property connection.port_name
[WARNING]: PortName property in schema DeviceEthernet is deprecated, This property is deprecated in favor of property connection.port_name
    simple_ondatra_test.go:80: configuration for OTG is {
          "ports": [
            {
              "name": "port1"
            },
            {
              "name": "port2"
            }
          ],
          "devices": [
            {
              "ethernets": [
                {
                  "port_name": "port1",
                  "mac": "02:00:01:01:01:01",
                  "mtu": 1500,
                  "name": "port1_ETH"
                }
              ],
              "name": "port1"
            },
            {
              "ethernets": [
                {
                  "port_name": "port2",
                  "mac": "02:00:02:01:01:01",
                  "mtu": 1500,
                  "name": "port2_ETH"
                }
              ],
              "name": "port2"
            }
          ]
        }
    simple_ondatra_test.go:82: 
        *** Pushing config to ate...
        
        
[WARNING]: PortName property in schema DeviceEthernet is deprecated, This property is deprecated in favor of property connection.port_name
[WARNING]: PortName property in schema DeviceEthernet is deprecated, This property is deprecated in favor of property connection.port_name
    simple_ondatra_test.go:328: 
        *** Pushing config to ate...
        
        
[WARNING]: PortName property in schema DeviceEthernet is deprecated, This property is deprecated in favor of property connection.port_name
[WARNING]: PortName property in schema DeviceEthernet is deprecated, This property is deprecated in favor of property connection.port_name
    simple_ondatra_test.go:330: Starting MPLS traffic...
    simple_ondatra_test.go:331: 
        *** Starting traffic on ate...
        
        
    simple_ondatra_test.go:332: Sleeping for 10s...
    simple_ondatra_test.go:334: Stopping MPLS traffic...
    simple_ondatra_test.go:335: 
        *** Stopping traffic on ate...
        
        
=== RUN   TestMPLSFlows/failure_-_two_flows,_one_that_is_not_mirrored
    simple_ondatra_test.go:68: 
        *** Creating new config for ate...
        
        
[WARNING]: PortName property in schema DeviceEthernet is deprecated, This property is deprecated in favor of property connection.port_name
[WARNING]: PortName property in schema DeviceEthernet is deprecated, This property is deprecated in favor of property connection.port_name
    simple_ondatra_test.go:80: configuration for OTG is {
          "ports": [
            {
              "name": "port1"
            },
            {
              "name": "port2"
            }
          ],
          "devices": [
            {
              "ethernets": [
                {
                  "port_name": "port1",
                  "mac": "02:00:01:01:01:01",
                  "mtu": 1500,
                  "name": "port1_ETH"
                }
              ],
              "name": "port1"
            },
            {
              "ethernets": [
                {
                  "port_name": "port2",
                  "mac": "02:00:02:01:01:01",
                  "mtu": 1500,
                  "name": "port2_ETH"
                }
              ],
              "name": "port2"
            }
          ]
        }
    simple_ondatra_test.go:82: 
        *** Pushing config to ate...
        
        
[WARNING]: PortName property in schema DeviceEthernet is deprecated, This property is deprecated in favor of property connection.port_name
[WARNING]: PortName property in schema DeviceEthernet is deprecated, This property is deprecated in favor of property connection.port_name
    simple_ondatra_test.go:328: 
        *** Pushing config to ate...
        
        
[WARNING]: PortName property in schema DeviceEthernet is deprecated, This property is deprecated in favor of property connection.port_name
[WARNING]: PortName property in schema DeviceEthernet is deprecated, This property is deprecated in favor of property connection.port_name
    simple_ondatra_test.go:330: Starting MPLS traffic...
    simple_ondatra_test.go:331: 
        *** Starting traffic on ate...
        
        
    simple_ondatra_test.go:332: Sleeping for 10s...
    simple_ondatra_test.go:334: Stopping MPLS traffic...
    simple_ondatra_test.go:335: 
        *** Stopping traffic on ate...
        
        
=== RUN   TestMPLSFlows/ten_flows
    simple_ondatra_test.go:68: 
        *** Creating new config for ate...
        
        
[WARNING]: PortName property in schema DeviceEthernet is deprecated, This property is deprecated in favor of property connection.port_name
[WARNING]: PortName property in schema DeviceEthernet is deprecated, This property is deprecated in favor of property connection.port_name
    simple_ondatra_test.go:80: configuration for OTG is {
          "ports": [
            {
              "name": "port1"
            },
            {
              "name": "port2"
            }
          ],
          "devices": [
            {
              "ethernets": [
                {
                  "port_name": "port1",
                  "mac": "02:00:01:01:01:01",
                  "mtu": 1500,
                  "name": "port1_ETH"
                }
              ],
              "name": "port1"
            },
            {
              "ethernets": [
                {
                  "port_name": "port2",
                  "mac": "02:00:02:01:01:01",
                  "mtu": 1500,
                  "name": "port2_ETH"
                }
              ],
              "name": "port2"
            }
          ]
        }
    simple_ondatra_test.go:82: 
        *** Pushing config to ate...
        
        
[WARNING]: PortName property in schema DeviceEthernet is deprecated, This property is deprecated in favor of property connection.port_name
[WARNING]: PortName property in schema DeviceEthernet is deprecated, This property is deprecated in favor of property connection.port_name
    simple_ondatra_test.go:328: 
        *** Pushing config to ate...
        
        
[WARNING]: PortName property in schema DeviceEthernet is deprecated, This property is deprecated in favor of property connection.port_name
[WARNING]: PortName property in schema DeviceEthernet is deprecated, This property is deprecated in favor of property connection.port_name
    simple_ondatra_test.go:330: Starting MPLS traffic...
    simple_ondatra_test.go:331: 
        *** Starting traffic on ate...
        
        
    simple_ondatra_test.go:332: Sleeping for 10s...
    simple_ondatra_test.go:334: Stopping MPLS traffic...
    simple_ondatra_test.go:335: 
        *** Stopping traffic on ate...
        
        
--- PASS: TestMPLSFlows (47.13s)
    --- PASS: TestMPLSFlows/two_flows_-_same_source_port (14.04s)
    --- PASS: TestMPLSFlows/failure_-_two_flows,_one_that_is_not_mirrored (15.04s)
    --- PASS: TestMPLSFlows/ten_flows (18.05s)
PASS

*** Releasing the testbed...

*** PROPERTY: time.begin -> 1692657284
*** PROPERTY: time.end -> 1692657346
ok  	command-line-arguments	63.410s

 * (M) e2e/simple_ondatra_test.go
   - Refactor to have more reusability.
   - Add test cases for multiple flows, and one that does not work.
 * (M) flows/mpls/mpls.go
   - Add support for resetting counters.
 * (M) kne/integration.testbed
   - Ensure that the wiring of the testbed is consistent.
 * (M) lwotg/flows(_test)?.go
   - Ensure that we do not accept >1 flow with the same name.
@github-actions
Copy link

Pull Request Test Coverage Report for Build 5932226892

  • 25 of 26 (96.15%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+1.0%) to 60.759%

Changes Missing Coverage Covered Lines Changed/Added Lines %
flows/mpls/mpls.go 19 20 95.0%
Totals Coverage Status
Change from base Build 5931409874: 1.0%
Covered Lines: 977
Relevant Lines: 1608

💛 - Coveralls

* Add multiple destination flows at a port and testing.

 * (M) kne/*
   - Update the integration testbeds.
 * (M) e2e/simple_ondatra_test.go
   - Add testing to ensure that multiple flows can be received at each
     port.

* Improve logging and parallelise stopping traffic.
@robshakir robshakir merged commit 4f6db63 into multi Aug 22, 2023
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants