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.
** 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
- func DstGroupMetadata(groupId int) (uint64, uint64)
- func SrcGroupMetadata(groupId int) (uint64, uint64)
- type EndpointInfo
- type OfnetAgent
- func (self *OfnetAgent) AddLocalEndpoint(endpoint EndpointInfo) error
- func (self *OfnetAgent) AddMaster(masterInfo *OfnetNode, ret *bool) error
- func (self *OfnetAgent) AddVlan(vlanId uint16, vni uint32) error
- func (self *OfnetAgent) AddVtepPort(portNo uint32, remoteIp net.IP) error
- func (self *OfnetAgent) Delete() error
- func (self *OfnetAgent) DummyRpc(arg *string, ret *bool) error
- func (self *OfnetAgent) EndpointAdd(epreg *OfnetEndpoint, ret *bool) error
- func (self *OfnetAgent) EndpointDel(epreg *OfnetEndpoint, ret *bool) error
- func (self *OfnetAgent) IsSwitchConnected() bool
- func (self *OfnetAgent) PacketRcvd(sw *ofctrl.OFSwitch, pkt *ofctrl.PacketIn)
- func (self *OfnetAgent) RemoveLocalEndpoint(portNo uint32) error
- func (self *OfnetAgent) RemoveMaster(masterInfo *OfnetNode) error
- func (self *OfnetAgent) RemoveVlan(vlanId uint16, vni uint32) error
- func (self *OfnetAgent) RemoveVtepPort(portNo uint32, remoteIp net.IP) error
- func (self *OfnetAgent) SwitchConnected(sw *ofctrl.OFSwitch)
- func (self *OfnetAgent) SwitchDisconnected(sw *ofctrl.OFSwitch)
- func (self *OfnetAgent) WaitForSwitchConnection()
- type OfnetDatapath
- type OfnetEndpoint
- type OfnetMaster
- func (self *OfnetMaster) AddRule(rule *OfnetPolicyRule) error
- func (self *OfnetMaster) DelRule(rule *OfnetPolicyRule) error
- func (self *OfnetMaster) Delete() error
- func (self *OfnetMaster) EndpointAdd(ep *OfnetEndpoint, ret *bool) error
- func (self *OfnetMaster) EndpointDel(ep *OfnetEndpoint, ret *bool) error
- func (self *OfnetMaster) MakeDummyRpcCall() error
- func (self *OfnetMaster) RegisterNode(hostInfo *OfnetNode, ret *bool) error
- type OfnetNode
- type OfnetPolicyRule
- type PolicyAgent
- func (self *PolicyAgent) AddEndpoint(endpoint *OfnetEndpoint) error
- func (self *PolicyAgent) AddRule(rule *OfnetPolicyRule, ret *bool) error
- func (self *PolicyAgent) DelEndpoint(endpoint *OfnetEndpoint) error
- func (self *PolicyAgent) DelRule(rule *OfnetPolicyRule, ret *bool) error
- func (self *PolicyAgent) InitTables(nextTblId uint8) error
- func (self *PolicyAgent) SwitchConnected(sw *ofctrl.OFSwitch)
- func (self *PolicyAgent) SwitchDisconnected(sw *ofctrl.OFSwitch)
- type PolicyRule
- type Vlan
- type VlanBridge
- func (self *VlanBridge) AddEndpoint(endpoint *OfnetEndpoint) error
- func (self *VlanBridge) AddLocalEndpoint(endpoint OfnetEndpoint) error
- func (self *VlanBridge) AddVlan(vlanId uint16, vni uint32) error
- func (self *VlanBridge) AddVtepPort(portNo uint32, remoteIp net.IP) error
- func (self *VlanBridge) MasterAdded(master *OfnetNode) error
- func (self *VlanBridge) PacketRcvd(sw *ofctrl.OFSwitch, pkt *ofctrl.PacketIn)
- func (self *VlanBridge) RemoveEndpoint(endpoint *OfnetEndpoint) error
- func (self *VlanBridge) RemoveLocalEndpoint(endpoint OfnetEndpoint) error
- func (self *VlanBridge) RemoveVlan(vlanId uint16, vni uint32) error
- func (self *VlanBridge) RemoveVtepPort(portNo uint32, remoteIp net.IP) error
- func (self *VlanBridge) SwitchConnected(sw *ofctrl.OFSwitch)
- func (self *VlanBridge) SwitchDisconnected(sw *ofctrl.OFSwitch)
- type Vrouter
- func (self *Vrouter) AddEndpoint(endpoint *OfnetEndpoint) error
- func (self *Vrouter) AddLocalEndpoint(endpoint OfnetEndpoint) error
- func (self *Vrouter) AddVlan(vlanId uint16, vni uint32) error
- func (self *Vrouter) AddVtepPort(portNo uint32, remoteIp net.IP) error
- func (self *Vrouter) MasterAdded(master *OfnetNode) error
- func (self *Vrouter) PacketRcvd(sw *ofctrl.OFSwitch, pkt *ofctrl.PacketIn)
- func (self *Vrouter) RemoveEndpoint(endpoint *OfnetEndpoint) error
- func (self *Vrouter) RemoveLocalEndpoint(endpoint OfnetEndpoint) error
- func (self *Vrouter) RemoveVlan(vlanId uint16, vni uint32) error
- func (self *Vrouter) RemoveVtepPort(portNo uint32, remoteIp net.IP) error
- func (self *Vrouter) SwitchConnected(sw *ofctrl.OFSwitch)
- func (self *Vrouter) SwitchDisconnected(sw *ofctrl.OFSwitch)
- type Vxlan
- func (self *Vxlan) AddEndpoint(endpoint *OfnetEndpoint) error
- func (self *Vxlan) AddLocalEndpoint(endpoint OfnetEndpoint) error
- func (self *Vxlan) AddVlan(vlanId uint16, vni uint32) error
- func (self *Vxlan) AddVtepPort(portNo uint32, remoteIp net.IP) error
- func (self *Vxlan) MasterAdded(master *OfnetNode) error
- func (self *Vxlan) PacketRcvd(sw *ofctrl.OFSwitch, pkt *ofctrl.PacketIn)
- func (self *Vxlan) RemoveEndpoint(endpoint *OfnetEndpoint) error
- func (self *Vxlan) RemoveLocalEndpoint(endpoint OfnetEndpoint) error
- func (self *Vxlan) RemoveVlan(vlanId uint16, vni uint32) error
- func (self *Vxlan) RemoveVtepPort(portNo uint32, remoteIp net.IP) error
- func (self *Vxlan) SwitchConnected(sw *ofctrl.OFSwitch)
- func (self *Vxlan) SwitchDisconnected(sw *ofctrl.OFSwitch)
Constants ¶
const DST_GRP_TBL_ID = 2
const FLOW_FLOOD_PRIORITY = 10 // Priority for flood entries
const FLOW_MATCH_PRIORITY = 100 // Priority for all match flows
const FLOW_MISS_PRIORITY = 1 // priority for table miss flow
const FLOW_POLICY_PRIORITY_OFFSET = 10 // Priority offset for policy rules
const IP_TBL_ID = 4
const MAC_DEST_TBL_ID = 5
const METADATA_RX_VTEP = 0x1
const OFNET_AGENT_PORT = 9002
const OFNET_MASTER_PORT = 9001
Default port numbers
const POLICY_TBL_ID = 3
const VLAN_TBL_ID = 1
Variables ¶
This section is empty.
Functions ¶
func DstGroupMetadata ¶
DstGroupMetadata returns metadata for dst group
func SrcGroupMetadata ¶
SrcGroupMetadata returns metadata for src group
Types ¶
type EndpointInfo ¶
type EndpointInfo struct { PortNo uint32 EndpointGroup int MacAddr net.HardwareAddr Vlan uint16 IpAddr net.IP }
local End point information
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) EndpointAdd ¶
func (self *OfnetAgent) EndpointAdd(epreg *OfnetEndpoint, ret *bool) error
Add remote endpoint RPC call from master
func (*OfnetAgent) EndpointDel ¶
func (self *OfnetAgent) EndpointDel(epreg *OfnetEndpoint, ret *bool) error
Delete remote endpoint RPC call from master
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
func (*OfnetAgent) WaitForSwitchConnection ¶
func (self *OfnetAgent) WaitForSwitchConnection()
WaitForSwitchConnection wait till switch connects
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 OfnetEndpoint) error // Remove a local endpoint from forwarding DB RemoveLocalEndpoint(endpoint OfnetEndpoint) error // Add a remote endpoint to forwarding DB AddEndpoint(endpoint *OfnetEndpoint) error // Remove a remote endpoint from forwarding DB RemoveEndpoint(endpoint *OfnetEndpoint) 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 OfnetEndpoint ¶
type OfnetEndpoint struct { EndpointID string // Unique identifier for the endpoint EndpointType string // Type of the endpoint "internal", "external" or "externalRoute" EndpointGroup int // Endpoint group identifier for policies. IpAddr net.IP // IP address of the end point VrfId uint16 // IP address namespace MacAddrStr string // Mac address of the end point(in string format) Vlan uint16 // Vlan Id for the endpoint Vni uint32 // Vxlan VNI OriginatorIp net.IP // Originating switch PortNo uint32 // Port number on originating switch Timestamp time.Time // Timestamp of the last event }
OfnetEndpoint has info about an endpoint
type OfnetMaster ¶
type OfnetMaster struct {
// contains filtered or unexported fields
}
Ofnet master state
func (*OfnetMaster) AddRule ¶
func (self *OfnetMaster) AddRule(rule *OfnetPolicyRule) error
AddRule adds a new rule to the policyDB
func (*OfnetMaster) DelRule ¶
func (self *OfnetMaster) DelRule(rule *OfnetPolicyRule) error
DelRule removes a rule from policy DB
func (*OfnetMaster) EndpointAdd ¶
func (self *OfnetMaster) EndpointAdd(ep *OfnetEndpoint, ret *bool) error
Add an Endpoint
func (*OfnetMaster) EndpointDel ¶
func (self *OfnetMaster) EndpointDel(ep *OfnetEndpoint, ret *bool) error
Delete an Endpoint
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
type OfnetPolicyRule ¶
type OfnetPolicyRule struct { RuleId string // Unique identifier for the rule Priority int // Priority for the rule (1..100. 100 is highest) SrcEndpointGroup int // Source endpoint group DstEndpointGroup int // Destination endpoint group SrcIpAddr string // source IP addrss and mask DstIpAddr string // Destination IP address and mask IpProtocol uint8 // IP protocol number SrcPort uint16 // Source port DstPort uint16 // destination port TcpFlags string // TCP flags to match: syn || syn,ack || ack || syn,!ack || !syn,ack; Action string // rule action: 'accept' or 'deny' }
OfnetPolicyRule has security rule to be installed
type PolicyAgent ¶
type PolicyAgent struct { Rules map[string]*PolicyRule // rules database DstGrpFlow map[string]*ofctrl.Flow // FLow entries for dst group lookup // contains filtered or unexported fields }
PolicyAgent is an instance of a policy agent
func NewPolicyAgent ¶
func NewPolicyAgent(agent *OfnetAgent, rpcServ *rpc.Server) *PolicyAgent
NewPolicyMgr Creates a new policy manager
func (*PolicyAgent) AddEndpoint ¶
func (self *PolicyAgent) AddEndpoint(endpoint *OfnetEndpoint) error
AddEndpoint adds an endpoint to dst group lookup
func (*PolicyAgent) AddRule ¶
func (self *PolicyAgent) AddRule(rule *OfnetPolicyRule, ret *bool) error
AddRule adds a security rule to policy table
func (*PolicyAgent) DelEndpoint ¶
func (self *PolicyAgent) DelEndpoint(endpoint *OfnetEndpoint) error
DelEndpoint deletes an endpoint from dst group lookup
func (*PolicyAgent) DelRule ¶
func (self *PolicyAgent) DelRule(rule *OfnetPolicyRule, ret *bool) error
DelRule deletes a security rule from policy table
func (*PolicyAgent) InitTables ¶
func (self *PolicyAgent) InitTables(nextTblId uint8) error
InitTables initializes policy table on the switch
func (*PolicyAgent) SwitchConnected ¶
func (self *PolicyAgent) SwitchConnected(sw *ofctrl.OFSwitch)
Handle switch connected notification
func (*PolicyAgent) SwitchDisconnected ¶
func (self *PolicyAgent) SwitchDisconnected(sw *ofctrl.OFSwitch)
Handle switch disconnected notification
type PolicyRule ¶
type PolicyRule struct {
// contains filtered or unexported fields
}
PolicyRule has info about single rule
type Vlan ¶
type Vlan struct { Vni uint32 // Vxlan VNI // contains filtered or unexported fields }
Vlan info
type VlanBridge ¶
type VlanBridge struct {
// contains filtered or unexported fields
}
Vlan state.
func NewVlanBridge ¶
func NewVlanBridge(agent *OfnetAgent, rpcServ *rpc.Server) *VlanBridge
Create a new vxlan instance
func (*VlanBridge) AddEndpoint ¶
func (self *VlanBridge) AddEndpoint(endpoint *OfnetEndpoint) error
AddEndpoint Add an endpoint to the datapath
func (*VlanBridge) AddLocalEndpoint ¶
func (self *VlanBridge) AddLocalEndpoint(endpoint OfnetEndpoint) error
Add a local endpoint and install associated local route
func (*VlanBridge) AddVlan ¶
func (self *VlanBridge) AddVlan(vlanId uint16, vni uint32) error
Add a vlan.
func (*VlanBridge) AddVtepPort ¶
func (self *VlanBridge) AddVtepPort(portNo uint32, remoteIp net.IP) error
Add virtual tunnel end point.
func (*VlanBridge) MasterAdded ¶
func (self *VlanBridge) MasterAdded(master *OfnetNode) error
Handle new master added event
func (*VlanBridge) PacketRcvd ¶
func (self *VlanBridge) PacketRcvd(sw *ofctrl.OFSwitch, pkt *ofctrl.PacketIn)
Handle incoming packet
func (*VlanBridge) RemoveEndpoint ¶
func (self *VlanBridge) RemoveEndpoint(endpoint *OfnetEndpoint) error
RemoveEndpoint removes an endpoint from the datapath
func (*VlanBridge) RemoveLocalEndpoint ¶
func (self *VlanBridge) RemoveLocalEndpoint(endpoint OfnetEndpoint) error
Remove local endpoint
func (*VlanBridge) RemoveVlan ¶
func (self *VlanBridge) RemoveVlan(vlanId uint16, vni uint32) error
Remove a vlan
func (*VlanBridge) RemoveVtepPort ¶
func (self *VlanBridge) RemoveVtepPort(portNo uint32, remoteIp net.IP) error
Remove a VTEP port
func (*VlanBridge) SwitchConnected ¶
func (self *VlanBridge) SwitchConnected(sw *ofctrl.OFSwitch)
Handle switch connected notification
func (*VlanBridge) SwitchDisconnected ¶
func (self *VlanBridge) SwitchDisconnected(sw *ofctrl.OFSwitch)
Handle switch disconnected notification
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) AddEndpoint ¶
func (self *Vrouter) AddEndpoint(endpoint *OfnetEndpoint) error
AddEndpoint Add an endpoint to the datapath
func (*Vrouter) AddLocalEndpoint ¶
func (self *Vrouter) AddLocalEndpoint(endpoint OfnetEndpoint) error
Add a local endpoint and install associated local route
func (*Vrouter) AddVtepPort ¶
Add virtual tunnel end point. This is mainly used for mapping remote vtep IP to ofp port number.
func (*Vrouter) MasterAdded ¶
Handle new master added event
func (*Vrouter) PacketRcvd ¶
Handle incoming packet
func (*Vrouter) RemoveEndpoint ¶
func (self *Vrouter) RemoveEndpoint(endpoint *OfnetEndpoint) error
RemoveEndpoint removes an endpoint from the datapath
func (*Vrouter) RemoveLocalEndpoint ¶
func (self *Vrouter) RemoveLocalEndpoint(endpoint OfnetEndpoint) error
Remove local endpoint
func (*Vrouter) RemoveVlan ¶
Remove a vlan
func (*Vrouter) RemoveVtepPort ¶
Remove a VTEP port
func (*Vrouter) SwitchConnected ¶
Handle switch connected notification
func (*Vrouter) SwitchDisconnected ¶
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) AddEndpoint ¶
func (self *Vxlan) AddEndpoint(endpoint *OfnetEndpoint) error
AddEndpoint Add an endpoint to the datapath
func (*Vxlan) AddLocalEndpoint ¶
func (self *Vxlan) AddLocalEndpoint(endpoint OfnetEndpoint) error
Add a local endpoint and install associated local route
func (*Vxlan) AddVtepPort ¶
Add virtual tunnel end point. This is mainly used for mapping remote vtep IP to ofp port number.
func (*Vxlan) MasterAdded ¶
Handle new master added event
func (*Vxlan) PacketRcvd ¶
Handle incoming packet
func (*Vxlan) RemoveEndpoint ¶
func (self *Vxlan) RemoveEndpoint(endpoint *OfnetEndpoint) error
RemoveEndpoint removes an endpoint from the datapath
func (*Vxlan) RemoveLocalEndpoint ¶
func (self *Vxlan) RemoveLocalEndpoint(endpoint OfnetEndpoint) error
Remove local endpoint
func (*Vxlan) RemoveVlan ¶
Remove a vlan
func (*Vxlan) RemoveVtepPort ¶
Remove a VTEP port
func (*Vxlan) SwitchConnected ¶
Handle switch connected notification
func (*Vxlan) SwitchDisconnected ¶
Handle switch disconnected notification
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
** Copyright 2014 Cisco Systems Inc.
|
** Copyright 2014 Cisco Systems Inc. |
** Copyright 2014 Cisco Systems Inc.
|
** Copyright 2014 Cisco Systems Inc. |