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

Create cmd-nse-vl3-vpp #1

Closed
edwarnicke opened this issue Aug 15, 2021 · 8 comments · Fixed by #4
Closed

Create cmd-nse-vl3-vpp #1

edwarnicke opened this issue Aug 15, 2021 · 8 comments · Fixed by #4
Assignees
Labels
ASAP As soon as possible enhancement New feature or request
Milestone

Comments

@edwarnicke
Copy link
Member

edwarnicke commented Aug 15, 2021

vl3 nse

image

Description

Create an NSE for vl3.

In the first pass, simply create an NSE that, given a request, uses networkservicemesh/sdk-vpp#341 to create a cmd-nse-vl3-vpp.

For ipam, start by using point2pointipam (we will become more sophisticated as we go along).

In the table created by networkservicemesh/sdk-vpp#341 program routes (see https://github.com/networkservicemesh/sdk-vpp/tree/main/pkg/networkservice/connectioncontext/ipcontext/routes which may be usable as is, or we may need a more sophisticated approach)for all incoming connections.

@edwarnicke
Copy link
Member Author

Note: this is a starting place, its a very simple single instance vL3. Subsequent issues will specify enhancements to make it more sophisticated.

@denis-tingaikin denis-tingaikin added the ASAP As soon as possible label Aug 16, 2021
@denis-tingaikin denis-tingaikin added this to the v1.1.0 milestone Aug 16, 2021
@denis-tingaikin
Copy link
Member

@denis-tingaikin
Copy link
Member

@edwarnicke I think we also need to follow this https://drive.google.com/file/d/1eMIkdlav1WwGaTKRgTnkhQ95Ipqw29bu/view for registration vl3 NSEs on startup.

@denis-tingaikin
Copy link
Member

denis-tingaikin commented Sep 9, 2021

Chain of vl3 use

point2pointipam.NewServer(ipnet),
iptable.NewServer(),
sendfd.NewServer(),
up.NewServer(ctx, vppConn),     
connectioncontext.NewServer(vppConn),  
tag.NewServer(ctx, vppConn),
mechanisms.NewServer(map[string]networkservice.NetworkServiceServer{            
  memif.MECHANISM: memif.NewServer(vppConn),   
  kernel.MECHANISM: ... ,
}, 
loopback.NewServer() // attach fib to the interface, fib table?

@glazychev-art
Copy link
Contributor

glazychev-art commented Oct 14, 2021

So, I see the following changes in the chain elements:

New chain elements:

  1. ✔️ [sdk] cidr - it is needed for CIDR allocation for a new vl3-NSE from any Global Prefix (for example 172.16.0.0/16). We store it in ipContext.ExtraPrefixes. It also keeps track of which CIDRs have already been allocated for others vl3-NSE (by Requests)
  2. [sdk] vl3ipam - allocates IPs. Has differences from point2pointipam:
  • If we receive a request from vl-NSE and it hasn't IP (srcIP) - we allocate it from its CIDR.
  • If we don't have our IP address (dstIP) - we allocate it from our CIDR and store in map[NetworkServiceName]ipAddress. In this case we have only one IP for a given NetworkService.
  • If we receive a request from a NSC - if works as p2p.
  1. [sdk-vpp] enableip6 - needed for IPv6. Look: https://lists.fd.io/g/vpp-dev/topic/ipv6_unnumbered_interface/85649127
  2. [sdk-vpp] loopback - needed for loopback interface creation. Only this interface will have IP-address.
  3. [sdk-vpp] unnumbered - if we have a loopback interface, we need to use unnumbered for a "main" interface instead of ipaddress chain element.

Updated chain elements:

  1. [sdk] ippool - probably we need to add to ippool a new method, that pulls a single IP (needed for vl3ipam. P2P uses PullP2PAddrs)
  2. ✔️ [sdk] prefixpool - probably a slight modification is needed for convenience (needed for cidr)
  3. ✔️ [sdk] up - we need to add WithLoadSwIfIndex option, because we can use loopback interface instead of "main" interface.
  4. ✔️ [sdk-vpp] ipaddress - add WithLoadSwIfIndex option (as for up chain-element). Also, we need to dump ipaddress of interface, instead of loading it from metadata. Because, for example, we could already set it on the client part of vl3-NSE, and we need to know about it on the server part.
  5. [sdk-vpp] vrf - creates an vrf-table (if doesn't exist) for a given NetworkService.
  6. [sdk-vpp] routes - we also need to get a vrfID for a correct configuration.
  7. ✔️ [sdk-vpp] wireguard - currently it works only as P2P. We need to update allowed-ip configuration - use routes, instead of Src/DstIP. Link

In the end, the client chain in vl3-NSE will look like:

...
			metadata.NewClient(),
			cidr.NewClient(config.PrefixLen, utils.GetIpFamily(config.CidrPrefix)),
			up.NewClient(ctx, vppConn, up.WithLoadSwIfIndex(loopback.Load)),
			ipaddress.NewClient(vppConn, ipaddress.WithLoadSwIfIndex(loopback.Load)),
			loopback.NewClient(vppConn, loopOpts...),
			up.NewClient(ctx, vppConn),
			mtu.NewClient(vppConn),
			routes.NewClient(vppConn),
			unnumbered.NewClient(vppConn),
			vrf.NewClient(vppConn, vrfOpts...),
			memif.NewClient(vppConn),
			sendfd.NewClient(),
			recvfd.NewClient(),
...

The server chain:

...
			cidr.NewServer(globalCIDR, ownPrefixes, excludePrefixes),
			vl3ipam.NewServer(ownIp, ipamPrefix),
			up.NewServer(ctx, vppConn, up.WithLoadSwIfIndex(loopback.Load)),
			ipaddress.NewServer(vppConn, ipaddress.WithLoadSwIfIndex(loopback.Load)),
			unnumbered.NewServer(vppConn),
			vrf.NewServer(vppConn, vrfOpts...),
			loopback.NewServer(vppConn, loopOpts...),
			mechanisms.NewServer(map[string]networkservice.NetworkServiceServer{
				memif.MECHANISM: chain.NewNetworkServiceServer(
					sendfd.NewServer(),
					up.NewServer(ctx, vppConn),
					mtu.NewServer(vppConn),
					routes.NewServer(vppConn),
					tag.NewServer(ctx, vppConn),
					memif.NewServer(vppConn),
				),
			}),
...

@denis-tingaikin
Copy link
Member

@edwarnicke Could you have a look? ☝️

@edwarnicke
Copy link
Member Author

@glazychev-art What is the status of this?

@glazychev-art
Copy link
Contributor

@edwarnicke There are a couple of PRs:
loopback - networkservicemesh/sdk-vpp#384
vl3ipam - need a cursory review - networkservicemesh/sdk#1192

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ASAP As soon as possible enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants