ofnet

package
v0.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 19, 2015 License: Apache-2.0, Apache-2.0 Imports: 10 Imported by: 0

README

Ofnet

Ofnet is a networking library that manages a network of openflow switches using a distributed controller architecture

Ofnet is a golang library that can be used by Container network drivers or container executors to manage a cluster wide network. Ofnet implements openflow 1.3 based controller and works with OpenVswitch. Ofnet manages only the openflow forwarding aspect of OVS. It does not create OVS interfaces/ports required by containers. It is assumed that container network driver creates OVS interface, moves it to container namespace and passes endpoint information to Ofnet library using its API.

Ofnet Controller supports multiple Software Defined Networking paradigms. They are

  1. vrouter - In this mode entire network operates like a giant router. IP packates are forwarded based on their IP dest address using a Vxlan overlay. Ofnet controller keeps track of all IP addresses in the network and programs OVS to lookup IP destination address and forward it using the overlay. It Proxies all ARP requests so that there is no need for broadcast in the network.
  2. vxlan bridge - In this mode each OVS acts as a VXLAN switch and together they emulate multiple bridge domains. This mode requires OVS 2.3.1 or higher.
  3. vlan bridge - Still in development

High level Architecture

Architecture

As shown above Ofnet Controller consists of Ofnet Agents that run on each host along with OVS and multiple Ofnet Masters. Ofnet agents can connect to any number of Ofnet Masters. Ofnet Masters largely act as state distributors. Ofnet Masters and Agents form an eventually consistent database that can survive multiple node failures, network partitioning and temporary hiccups. Controller state is guaranteed to eventually reach a consistent state.

Ofnet controller supports the concept of multiple networks. Depending on the forwarding paradign, this can be mapped to Tenats(VRF in networking lingo, VPC in cloud lingo), Subnets or bridge domains.

Multiple datapath plugins

Datapath Plugins

Ofnet Controller supports multiple data path plugins. Currently vrouter and vxlan plugins are implemented. Vlan plugin is in development. These plugins use Ofctrl library to program Flows in OVS. Please see Ofctrl subdirectory on more details.

Usage

Documentation

Overview

** Copyright 2014 Cisco Systems Inc. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

** Copyright 2014 Cisco Systems Inc. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

** Copyright 2014 Cisco Systems Inc. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

** Copyright 2014 Cisco Systems Inc. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const FLOW_FLOOD_PRIORITY = 10 // Priority for flood entries
View Source
const FLOW_MATCH_PRIORITY = 100 // Priority for all match flows
View Source
const FLOW_MISS_PRIORITY = 1 // priority for table miss flow
View Source
const IP_TBL_ID = 2
View Source
const MAC_DEST_TBL_ID = 3
View Source
const METADATA_RX_VTEP = 0x1
View Source
const OFNET_AGENT_PORT = 9002
View Source
const OFNET_MASTER_PORT = 9001

Default port numbers

View Source
const VLAN_TBL_ID = 1

Variables

This section is empty.

Functions

This section is empty.

Types

type EndpointInfo

type EndpointInfo struct {
	PortNo  uint32
	MacAddr net.HardwareAddr
	Vlan    uint16
	IpAddr  net.IP
}

local End point information

type MacRoute

type MacRoute struct {
	MacAddrStr   string    // Mac address of the end point(in string format)
	Vni          uint32    // Vxlan VNI
	OriginatorIp net.IP    // Originating switch
	PortNo       uint32    // Port number on originating switch
	Timestamp    time.Time // Timestamp of the last event
}

Mac address info

type OfnetAgent

type OfnetAgent struct {
	MyPort uint16 // Port where the agent's RPC server is listening
	MyAddr string // RPC server addr. same as localIp. different in testing environments
	// contains filtered or unexported fields
}

OfnetAgent state

func NewOfnetAgent

func NewOfnetAgent(dpName string, localIp net.IP, rpcPort uint16, ovsPort uint16) (*OfnetAgent, error)

Create a new Ofnet agent and initialize it

func (*OfnetAgent) AddLocalEndpoint

func (self *OfnetAgent) AddLocalEndpoint(endpoint EndpointInfo) error

Add a local endpoint. This takes ofp port number, mac address, vlan and IP address of the port.

func (*OfnetAgent) AddMaster

func (self *OfnetAgent) AddMaster(masterInfo *OfnetNode, ret *bool) error

Add a master ofnet agent tries to connect to the master and download routes

func (*OfnetAgent) AddVlan

func (self *OfnetAgent) AddVlan(vlanId uint16, vni uint32) error

Add a vlan. This is mainly used for mapping vlan id to Vxlan VNI

func (*OfnetAgent) AddVtepPort

func (self *OfnetAgent) AddVtepPort(portNo uint32, remoteIp net.IP) error

Add virtual tunnel end point. This is mainly used for mapping remote vtep IP to ofp port number.

func (*OfnetAgent) Delete

func (self *OfnetAgent) Delete() error

Delete cleans up an ofnet agent

func (*OfnetAgent) DummyRpc

func (self *OfnetAgent) DummyRpc(arg *string, ret *bool) error

func (*OfnetAgent) IsSwitchConnected

func (self *OfnetAgent) IsSwitchConnected() bool

IsSwitchConnected returns true if switch is connected

func (*OfnetAgent) PacketRcvd

func (self *OfnetAgent) PacketRcvd(sw *ofctrl.OFSwitch, pkt *ofctrl.PacketIn)

Receive a packet from the switch.

func (*OfnetAgent) RemoveLocalEndpoint

func (self *OfnetAgent) RemoveLocalEndpoint(portNo uint32) error

Remove local endpoint

func (*OfnetAgent) RemoveMaster

func (self *OfnetAgent) RemoveMaster(masterInfo *OfnetNode) error

Remove the master from master DB

func (*OfnetAgent) RemoveVlan

func (self *OfnetAgent) RemoveVlan(vlanId uint16, vni uint32) error

Remove a vlan from datapath

func (*OfnetAgent) RemoveVtepPort

func (self *OfnetAgent) RemoveVtepPort(portNo uint32, remoteIp net.IP) error

Remove a VTEP port

func (*OfnetAgent) SwitchConnected

func (self *OfnetAgent) SwitchConnected(sw *ofctrl.OFSwitch)

Handle switch connected event

func (*OfnetAgent) SwitchDisconnected

func (self *OfnetAgent) SwitchDisconnected(sw *ofctrl.OFSwitch)

Handle switch disconnect event

type OfnetDatapath

type OfnetDatapath interface {
	// New master was added.
	MasterAdded(master *OfnetNode) error

	// Switch connected notification
	SwitchConnected(sw *ofctrl.OFSwitch)

	// Switch disconnected notification
	SwitchDisconnected(sw *ofctrl.OFSwitch)

	// Process Incoming packet
	PacketRcvd(sw *ofctrl.OFSwitch, pkt *ofctrl.PacketIn)

	// Add a local endpoint to forwarding DB
	AddLocalEndpoint(endpoint EndpointInfo) error

	// Remove a local endpoint from forwarding DB
	RemoveLocalEndpoint(portNo uint32) error

	// Add an remote VTEP
	AddVtepPort(portNo uint32, remoteIp net.IP) error

	// Remove remote VTEP
	RemoveVtepPort(portNo uint32, remoteIp net.IP) error

	// Add a vlan
	AddVlan(vlanId uint16, vni uint32) error

	// Remove a vlan
	RemoveVlan(vlanId uint16, vni uint32) error
}

Interface implemented by each datapath

type OfnetMaster

type OfnetMaster struct {
	// contains filtered or unexported fields
}

Ofnet master state

func NewOfnetMaster

func NewOfnetMaster(portNo uint16) *OfnetMaster

Create new Ofnet master

func (*OfnetMaster) Delete

func (self *OfnetMaster) Delete() error

Delete closes rpc listener

func (*OfnetMaster) MacRouteAdd

func (self *OfnetMaster) MacRouteAdd(macRoute *MacRoute, ret *bool) error

Add a mac route

func (*OfnetMaster) MacRouteDel

func (self *OfnetMaster) MacRouteDel(macRoute *MacRoute, ret *bool) error

Delete a mac route

func (*OfnetMaster) MakeDummyRpcCall

func (self *OfnetMaster) MakeDummyRpcCall() error

Make a dummy RPC call to all agents. for testing purposes..

func (*OfnetMaster) RegisterNode

func (self *OfnetMaster) RegisterNode(hostInfo *OfnetNode, ret *bool) error

Register an agent

func (*OfnetMaster) RouteAdd

func (self *OfnetMaster) RouteAdd(route *OfnetRoute, ret *bool) error

Add a route

func (*OfnetMaster) RouteDel

func (self *OfnetMaster) RouteDel(route *OfnetRoute, ret *bool) error

Delete a route

type OfnetNode

type OfnetNode struct {
	HostAddr string
	HostPort uint16
}

Information about each node

type OfnetRoute

type OfnetRoute struct {
	IpAddr       net.IP    // IP address of the end point
	VrfId        uint16    // IP address namespace
	OriginatorIp net.IP    // Originating switch
	PortNo       uint32    // Port number on originating switch
	Timestamp    time.Time // Timestamp of the last event
}

IP Route information

type Vlan

type Vlan struct {
	Vni uint32 // Vxlan VNI
	// contains filtered or unexported fields
}

Vlan info

type Vrouter

type Vrouter struct {
	// contains filtered or unexported fields
}

Vrouter state. One Vrouter instance exists on each host

func NewVrouter

func NewVrouter(agent *OfnetAgent, rpcServ *rpc.Server) *Vrouter

Create a new vrouter instance

func (*Vrouter) AddLocalEndpoint

func (self *Vrouter) AddLocalEndpoint(endpoint EndpointInfo) error

Add a local endpoint and install associated local route

func (*Vrouter) AddVlan

func (self *Vrouter) AddVlan(vlanId uint16, vni uint32) error

Add a vlan. This is mainly used for mapping vlan id to Vxlan VNI

func (*Vrouter) AddVtepPort

func (self *Vrouter) AddVtepPort(portNo uint32, remoteIp net.IP) error

Add virtual tunnel end point. This is mainly used for mapping remote vtep IP to ofp port number.

func (*Vrouter) MasterAdded

func (self *Vrouter) MasterAdded(master *OfnetNode) error

Handle new master added event

func (*Vrouter) PacketRcvd

func (self *Vrouter) PacketRcvd(sw *ofctrl.OFSwitch, pkt *ofctrl.PacketIn)

Handle incoming packet

func (*Vrouter) RemoveLocalEndpoint

func (self *Vrouter) RemoveLocalEndpoint(portNo uint32) error

Remove local endpoint

func (*Vrouter) RemoveVlan

func (self *Vrouter) RemoveVlan(vlanId uint16, vni uint32) error

Remove a vlan

func (*Vrouter) RemoveVtepPort

func (self *Vrouter) RemoveVtepPort(portNo uint32, remoteIp net.IP) error

Remove a VTEP port

func (*Vrouter) RouteAdd

func (self *Vrouter) RouteAdd(route *OfnetRoute, ret *bool) error

Add remote route RPC call from master

func (*Vrouter) RouteDel

func (self *Vrouter) RouteDel(route *OfnetRoute, ret *bool) error

Delete remote route RPC call from master

func (*Vrouter) SwitchConnected

func (self *Vrouter) SwitchConnected(sw *ofctrl.OFSwitch)

Handle switch connected notification

func (*Vrouter) SwitchDisconnected

func (self *Vrouter) SwitchDisconnected(sw *ofctrl.OFSwitch)

Handle switch disconnected notification

type Vxlan

type Vxlan struct {
	// contains filtered or unexported fields
}

Vxlan state.

func NewVxlan

func NewVxlan(agent *OfnetAgent, rpcServ *rpc.Server) *Vxlan

Create a new vxlan instance

func (*Vxlan) AddLocalEndpoint

func (self *Vxlan) AddLocalEndpoint(endpoint EndpointInfo) error

Add a local endpoint and install associated local route

func (*Vxlan) AddVlan

func (self *Vxlan) AddVlan(vlanId uint16, vni uint32) error

Add a vlan.

func (*Vxlan) AddVtepPort

func (self *Vxlan) AddVtepPort(portNo uint32, remoteIp net.IP) error

Add virtual tunnel end point. This is mainly used for mapping remote vtep IP to ofp port number.

func (*Vxlan) MacRouteAdd

func (self *Vxlan) MacRouteAdd(macRoute *MacRoute, ret *bool) error

Mac route add rpc call from master

func (*Vxlan) MacRouteDel

func (self *Vxlan) MacRouteDel(macRoute *MacRoute, ret *bool) error

Mac route delete rpc call from master

func (*Vxlan) MasterAdded

func (self *Vxlan) MasterAdded(master *OfnetNode) error

Handle new master added event

func (*Vxlan) PacketRcvd

func (self *Vxlan) PacketRcvd(sw *ofctrl.OFSwitch, pkt *ofctrl.PacketIn)

Handle incoming packet

func (*Vxlan) RemoveLocalEndpoint

func (self *Vxlan) RemoveLocalEndpoint(portNo uint32) error

Remove local endpoint

func (*Vxlan) RemoveVlan

func (self *Vxlan) RemoveVlan(vlanId uint16, vni uint32) error

Remove a vlan

func (*Vxlan) RemoveVtepPort

func (self *Vxlan) RemoveVtepPort(portNo uint32, remoteIp net.IP) error

Remove a VTEP port

func (*Vxlan) SwitchConnected

func (self *Vxlan) SwitchConnected(sw *ofctrl.OFSwitch)

Handle switch connected notification

func (*Vxlan) SwitchDisconnected

func (self *Vxlan) SwitchDisconnected(sw *ofctrl.OFSwitch)

Handle switch disconnected notification

Directories

Path Synopsis
** Copyright 2014 Cisco Systems Inc.
** Copyright 2014 Cisco Systems Inc.
** Copyright 2014 Cisco Systems Inc.
** Copyright 2014 Cisco Systems Inc.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL