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

API for SPAN #1430

Merged
merged 11 commits into from
Aug 19, 2019
Merged

API for SPAN #1430

merged 11 commits into from
Aug 19, 2019

Conversation

rewenset
Copy link
Contributor

@rewenset rewenset commented Aug 5, 2019

Related issue #1386

TODO:

  • add bad cases to integration tests
  • generate binary API for 1901 and 1908 and use it in vppcalls instead of using 1904 binary API in both 1901 and 1908

@ondrej-fabry ondrej-fabry added 🚧 WIP do not merge! work in progress! ⚡️ feature labels Aug 5, 2019
@rewenset
Copy link
Contributor Author

rewenset commented Aug 8, 2019

I did tests with ETCD:

Create SPAN before starting vpp-agent without any interfaces

➜ docker exec etcd etcdctl put /vnf-agent/vpp1/config/vpp/v2/span/tap0/to/tap1 \
'{"interfaceFrom": "tap0", "interfaceTo": "tap1", "state": 1}'
OK
+======================================================================================================================+
| #0 - NB Transaction                                                                                       FullResync |
+======================================================================================================================+
  * transaction arguments:
      - seqNum: 0
      - type: NB Transaction, Full Resync
      - values:
          - key: config/vpp/v2/span/tap0/to/tap1
            val: { interface_from:"tap0" interface_to:"tap1" state:RX  }

o----------------------------------------------------------------------------------------------------------------------o
  * executed operations (2019-08-08 07:49:26.833 +0000 UTC -> 2019-08-08 07:49:26.884 +0000 UTC, dur: 51ms):
      1. CREATE [NOOP IS-PENDING]:
          - key: config/vpp/v2/span/tap0/to/tap1
          - value: { interface_from:"tap0" interface_to:"tap1" state:RX  } 
x----------------------------------------------------------------------------------------------------------------------x
| #0 - NB Transaction                                                                                      took 51.2ms |
x----------------------------------------------------------------------------------------------------------------------x

Add interfaces while vpp-agent is running

      2. CREATE [WAS-PENDING]:                                                                                                                                                                                       
          - key: config/vpp/v2/span/tap0/to/tap1                                                                                                                                                                     
          - value: { interface_from:"tap0" interface_to:"tap1" state:RX  }  

Update SPAN while vpp-agent is running

➜ docker exec etcd etcdctl put /vnf-agent/vpp1/config/vpp/v2/span/tap0/to/tap1 \
'{"interfaceFrom": "tap0", "interfaceTo": "tap1", "state": 2}'
OK
+======================================================================================================================+
| #7 - NB Transaction                                                                                                  |
+======================================================================================================================+
  * transaction arguments:
      - seqNum: 7
      - type: NB Transaction
      - values:
          - key: config/vpp/v2/span/tap0/to/tap1
            val: { interface_from:"tap0" interface_to:"tap1" state:TX  }

o----------------------------------------------------------------------------------------------------------------------o
  * executed operations (2019-08-08 07:53:31.165 +0000 UTC -> 2019-08-08 07:53:31.175 +0000 UTC, dur: 10ms):
      1. DELETE [RECREATE]:
          - key: config/vpp/v2/span/tap0/to/tap1
          - value: { interface_from:"tap0" interface_to:"tap1" state:RX  } 
      2. CREATE [RECREATE]:
          - key: config/vpp/v2/span/tap0/to/tap1
          - value: { interface_from:"tap0" interface_to:"tap1" state:TX  } 
x----------------------------------------------------------------------------------------------------------------------x
| #7 - NB Transaction                                                                                      took 10.3ms |
x----------------------------------------------------------------------------------------------------------------------x

Delete SPAN while vpp-agent is running

➜ docker exec etcd etcdctl del /vnf-agent/vpp1/config/vpp/v2/span/tap0/to/tap1
1
+======================================================================================================================+
| #8 - NB Transaction                                                                                                  |
+======================================================================================================================+
  * transaction arguments:
      - seqNum: 8
      - type: NB Transaction
      - values:
          - key: config/vpp/v2/span/tap0/to/tap1
            val: <NIL>

o----------------------------------------------------------------------------------------------------------------------o
  * executed operations (2019-08-08 07:55:06.118 +0000 UTC -> 2019-08-08 07:55:06.119 +0000 UTC, dur: 0s):
      1. DELETE:
          - key: config/vpp/v2/span/tap0/to/tap1
          - value: { interface_from:"tap0" interface_to:"tap1" state:TX  } 
x----------------------------------------------------------------------------------------------------------------------x
| #8 - NB Transaction                                                                                       took 500µs |
x----------------------------------------------------------------------------------------------------------------------x

Create SPAN again while vpp-agent is running

➜ docker exec etcd etcdctl put /vnf-agent/vpp1/config/vpp/v2/span/tap0/to/tap1 \
'{"interfaceFrom": "tap0", "interfaceTo": "tap1", "state": 3}'
OK
+======================================================================================================================+
| #16 - NB Transaction                                                                                                 |
+======================================================================================================================+
  * transaction arguments:
      - seqNum: 16
      - type: NB Transaction
      - values:
          - key: config/vpp/v2/span/tap0/to/tap1
            val: { interface_from:"tap0" interface_to:"tap1" state:BOTH  }

o----------------------------------------------------------------------------------------------------------------------o
  * executed operations (2019-08-08 07:58:24.506 +0000 UTC -> 2019-08-08 07:58:24.512 +0000 UTC, dur: 5ms):
      1. CREATE:
          - key: config/vpp/v2/span/tap0/to/tap1
          - value: { interface_from:"tap0" interface_to:"tap1" state:BOTH  } 
x----------------------------------------------------------------------------------------------------------------------x
| #16 - NB Transaction                                                                                      took 5.2ms |
x----------------------------------------------------------------------------------------------------------------------x

Stop and start vpp-agent

+======================================================================================================================+                                                                                             
| #0 - NB Transaction                                                                                       FullResync |                                                                                             
+======================================================================================================================+                                                                                             
  * transaction arguments:                                                                                                                                                                                           
      - seqNum: 0            
      - type: NB Transaction, Full Resync
      - values:                                    
          - key: config/vpp/v2/interfaces/tap0
            val: { name:"tap0" type:TAP enabled:true ip_addresses:"10.10.1.2/24" tap:<version:2 >  }
          - key: config/vpp/v2/interfaces/tap1                                                                          
            val: { name:"tap1" type:TAP enabled:true ip_addresses:"10.20.1.2/24" tap:<version:2 >  }      
          - key: config/vpp/v2/span/tap0/to/tap1
            val: { interface_from:"tap0" interface_to:"tap1" state:BOTH  }
                          
o----------------------------------------------------------------------------------------------------------------------o            
  * executed operations (2019-08-08 08:01:19.574 +0000 UTC -> 2019-08-08 08:01:19.694 +0000 UTC, dur: 120ms):           
      1. CREATE:                                                                                                        
          - key: config/vpp/v2/interfaces/tap0                                                                          
          - value: { name:"tap0" type:TAP enabled:true ip_addresses:"10.10.1.2/24" tap:<version:2 >  }
      [ ... ]
      5. CREATE:
          - key: config/vpp/v2/interfaces/tap1
          - value: { name:"tap1" type:TAP enabled:true ip_addresses:"10.20.1.2/24" tap:<version:2 >  }
      [ ... ]
      9. CREATE:
          - key: config/vpp/v2/span/tap0/to/tap1
          - value: { interface_from:"tap0" interface_to:"tap1" state:BOTH  }
x----------------------------------------------------------------------------------------------------------------------x
| #0 - NB Transaction                                                                                     took 119.6ms |
x----------------------------------------------------------------------------------------------------------------------x

Show interfaces and SPAN table using `vppctl`

    _______    _        _   _____  ___
 __/ __/ _ \  (_)__    | | / / _ \/ _ \
 _/ _// // / / / _ \   | |/ / ___/ ___/
 /_/ /____(_)_/\___/   |___/_/  /_/

vpp# sh int
              Name               Idx    State  MTU (L3/IP4/IP6/MPLS)     Counter          Count
local0                            0     down          0/0/0/0
tap0                              1      up          9000/0/0/0
tap1                              2      up          9000/0/0/0
vpp# sh int span
Source                           Destination                       Device       L2
tap0                             tap1                             (  both) (  none)
vpp#

@ondrej-fabry ondrej-fabry self-requested a review August 8, 2019 08:14
@rewenset rewenset changed the title WIP: API for SPAN API for SPAN Aug 8, 2019
@ondrej-fabry ondrej-fabry removed the 🚧 WIP do not merge! work in progress! label Aug 8, 2019
@milanlenco
Copy link
Collaborator

@rewenset could you also please test the scenario in which only agent is restarted, but VPP remains running? In that case the first resync transaction should do nothing (no operations) since everything is already configured as requested by etcd content.
Thank you

option (gogoproto.messagename_all) = true;

message Span {
enum State {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it be better to call this parameter "Direction"? "State" sounds like something related to runtime status as opposed to configuration.

string interface_from = 1;
string interface_to = 2;
State state = 3;
bool is_l2 = 4;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix the formatting (probably mixed tabs and spaces)

@@ -136,6 +138,8 @@ type DeleteDSL interface {

// VppInterface adds a request to delete an existing VPP network interface.
VppInterface(ifaceName string) DeleteDSL
// VppSpan adds VPP span to the Delete request.
VppSpan(span *vpp_interfaces.Span) DeleteDSL
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just call it Span across the client - no need to prefix with "Vpp" since there is no LinuxSpan

}
if value.InterfaceTo == "" {
return kvs.NewInvalidValueError(ErrSpanWithoutInterface, "interface_to")
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please check also that State is not UNKNOWN

@milanlenco
Copy link
Collaborator

Please address the review comments and then re-check the problematic agent-restart scenario with this bug fix applied: #1432

@ondrej-fabry
Copy link
Member

@rewenset Please fix the issues reported by Travis.

@rewenset
Copy link
Contributor Author

rewenset commented Aug 11, 2019

First of all, sorry for not fixing tests and doing this agent-restart scenario earlier 🙏

"Restart Agent without restarting VPP" test

(tested with bug fix applied: #1432)
After restart, Agent runs only FullResync transaction without any executed operations. Everything looks good. SPAN is working.

Show FullResync transaction

+======================================================================================================================+
| #0 - NB Transaction                                                                                       FullResync |
+======================================================================================================================+
  * transaction arguments:
      - seqNum: 0
      - type: NB Transaction, Full Resync
      - values:
          - key: config/vpp/v2/interfaces/tap0
            val: { name:"tap0" type:TAP enabled:true ip_addresses:"10.10.1.2/24" tap:<version:2 host_if_name:"vpptap0" >  }
          - key: config/vpp/v2/interfaces/tap1
            val: { name:"tap1" type:TAP enabled:true ip_addresses:"10.20.1.2/24" tap:<version:2 host_if_name:"vpptap1" >  }
          - key: config/vpp/v2/span/tap0/to/tap1
            val: { interface_from:"tap0" interface_to:"tap1" direction:RX  }

o----------------------------------------------------------------------------------------------------------------------o
  * executed operations:
      <NONE>
x----------------------------------------------------------------------------------------------------------------------x
| #0 - NB Transaction                                                                                     took 116.7ms |
x----------------------------------------------------------------------------------------------------------------------x

INFO[0000] Transaction #0 successful! (took 119.6ms)     loc="orchestrator/dispatcher.go(179)" logger=dispatcher

@ondrej-fabry ondrej-fabry merged commit e8fa2f9 into ligato:dev Aug 19, 2019
@ondrej-fabry ondrej-fabry mentioned this pull request Aug 19, 2019
@ondrej-fabry ondrej-fabry added this to Done in BF Sep 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
BF
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants