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 support for reporting on multiple flows. #29

Merged
merged 4 commits into from
Aug 22, 2023
Merged

Add support for reporting on multiple flows. #29

merged 4 commits into from
Aug 22, 2023

Conversation

robshakir
Copy link
Contributor

* (M) flows/mpls/mpls.go
  - Previously we would just report on the latest flow meaning that >1
    flow was not supported in tests. This change adds a reporter that
    can report on multiple flows.

    Testing here is minimal because the wider magna code needs to be
    initiating flows to meaningfully test this.
* (M) e2e/simple_ondatra_test.go
  - Add e2e test that covers multiple MPLS flows.

Successful test run output:

I0821 20:55:47.203892   27140 topo.go:151] Trying in-cluster configuration
I0821 20:55:47.203960   27140 topo.go:154] Falling back to kubeconfig: "/usr/local/google/home/robjs/.kube/config"
I0821 20:55:47.205226   27140 topo.go:357] Adding Link: ate:eth1 mirror:eth1
I0821 20:55:47.205244   27140 topo.go:357] Adding Link: ate:eth2 mirror:eth2
I0821 20:55:47.205250   27140 topo.go:398] Adding Node: ate:OPENCONFIG
I0821 20:55:47.205273   27140 topo.go:398] Adding Node: mirror:HOST

*** Reserving the testbed...

I0821 20:55:47.205707   27140 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 20:55:47.237568   27140 dut.go:271] Could not dial GNMI to dut mirror: service "gnmi" not found on DUT "mirror"
*** PROPERTY: test.path -> e2e
*** PROPERTY: build.go_version -> go1.22-20230729-RC00 cl/552016856 +457721cd52 X:fieldtrack,boringcrypto
*** PROPERTY: build.path -> 
*** PROPERTY: build.main.path -> 
*** PROPERTY: build.main.version -> 
*** PROPERTY: build.main.sum -> 
*** PROPERTY: git.commit -> 30abb3e1d260f66275ee2781aefab1d559b4c6d6
*** PROPERTY: git.status -> M  e2e/simple_ondatra_test.go
M  flows/mpls/mpls.go
M  go.mod
M  go.sum
?? foo
?? test_report.md

*** PROPERTY: git.origin -> [email protected]:openconfig/magna.git
*** PROPERTY: git.commit_timestamp -> 1689954235
*** PROPERTY: git.clean -> false
*** PROPERTY: topology -> ate:2,mirror:2

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

  Testbed Reservation Complete
  ID: 4a30e0f2-674d-4641-8163-6c61664153de

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

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

=== 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.05s)
=== 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:285: 
        *** 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:287: Starting MPLS traffic...
    simple_ondatra_test.go:288: 
        *** Starting traffic on ate...
        
        
    simple_ondatra_test.go:289: Sleeping for 10s...
    simple_ondatra_test.go:291: Stopping MPLS traffic...
    simple_ondatra_test.go:292: 
        *** Stopping traffic on ate...
        
        
--- PASS: TestMPLSFlows (15.05s)
    --- PASS: TestMPLSFlows/two_flows_-_same_source_port (15.05s)
PASS

*** Releasing the testbed...

*** PROPERTY: time.begin -> 1692651347
*** PROPERTY: time.end -> 1692651377
ok  	command-line-arguments	31.335s

 * (M) flows/mpls/mpls.go
   - Previously we would just report on the latest flow meaning that >1
     flow was not supported in tests. This change adds a reporter that
     can report on multiple flows.

     Testing here is minimal because the wider magna code needs to be
     initiating flows to meaningfully test this.
 * (M) e2e/simple_ondatra_test.go
   - Add e2e test that covers multiple MPLS flows.
@github-actions
Copy link

Pull Request Test Coverage Report for Build 5931409874

  • 0 of 34 (0.0%) changed or added relevant lines in 1 file are covered.
  • 3 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-1.2%) to 59.761%

Changes Missing Coverage Covered Lines Changed/Added Lines %
flows/mpls/mpls.go 0 34 0.0%
Files with Coverage Reduction New Missed Lines %
lwotgtelem/gnmit/subscribe/subscribe.go 3 68.57%
Totals Coverage Status
Change from base Build 5624123780: -1.2%
Covered Lines: 952
Relevant Lines: 1593

💛 - Coveralls

 * (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.
* 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 40ba2dd into main Aug 22, 2023
6 checks passed
@robshakir robshakir deleted the multi branch August 22, 2023 21:17
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.

3 participants