Documentation
¶
Index ¶
- Constants
- Variables
- func CheckIPAddress(ip string) error
- func ConfigureTable(ctx context.Context, p4RtC *client.Client, P4w P4RtCWrapper, ...) error
- func GenerateMask(index int) uint8
- func GetStr(action InterfaceType) string
- func IP4toInt(IPv4Address net.IP) int64
- func Pack32BinaryIP4(ip4Address string) []byte
- func ParseIPCIDR(cidr string) (net.IP, *net.IPNet, error)
- func PrepareTable(tblaction map[string][]UpdateTable, tbl *Table)
- func ToBytes(data interface{}) []byte
- type ActionParam
- type IdGenerator
- type InterfaceType
- type KeyData
- type MockP4
- func (m MockP4) DeleteActionProfileGroup(ctx context.Context, p4RtC *client.Client, entry *p4_v1.ActionProfileGroup) error
- func (m MockP4) DeleteActionProfileMember(ctx context.Context, p4RtC *client.Client, entry *p4_v1.ActionProfileMember) error
- func (m MockP4) DeleteTableEntry(ctx context.Context, p4RtC *client.Client, entry *p4_v1.TableEntry) error
- func (m MockP4) InsertActionProfileGroup(ctx context.Context, p4RtC *client.Client, entry *p4_v1.ActionProfileGroup) error
- func (m MockP4) InsertActionProfileMember(ctx context.Context, p4RtC *client.Client, entry *p4_v1.ActionProfileMember) error
- func (m MockP4) InsertTableEntry(ctx context.Context, p4RtC *client.Client, entry *p4_v1.TableEntry) error
- func (m MockP4) ModifyActionProfileGroup(ctx context.Context, p4RtC *client.Client, entry *p4_v1.ActionProfileGroup) error
- func (m MockP4) ModifyActionProfileMember(ctx context.Context, p4RtC *client.Client, entry *p4_v1.ActionProfileMember) error
- func (m MockP4) NewActionProfileGroup(p4RtC *client.Client, actionProfile string, groupID uint32, ...) *p4_v1.ActionProfileGroup
- func (m MockP4) NewActionProfileMember(p4RtC *client.Client, actionProfile string, memberID uint32, action string, ...) *p4_v1.ActionProfileMember
- func (m MockP4) NewTableActionDirect(p4RtC *client.Client, action string, params [][]byte) *p4_v1.TableAction
- func (m MockP4) NewTableActionGroup(p4RtC *client.Client, groupID uint32) *p4_v1.TableAction
- func (m MockP4) NewTableEntry(p4RtC *client.Client, table string, mfs map[string]client.MatchInterface, ...) *p4_v1.TableEntry
- type P4RtCWrapper
- type P4RtCWrapperStruct
- func (P4RtC P4RtCWrapperStruct) DeleteActionProfileGroup(ctx context.Context, p4RtC *client.Client, entry *p4_v1.ActionProfileGroup) error
- func (P4RtC P4RtCWrapperStruct) DeleteActionProfileMember(ctx context.Context, p4RtC *client.Client, entry *p4_v1.ActionProfileMember) error
- func (P4RtC P4RtCWrapperStruct) DeleteTableEntry(ctx context.Context, p4RtC *client.Client, entry *p4_v1.TableEntry) error
- func (P4RtC P4RtCWrapperStruct) InsertActionProfileGroup(ctx context.Context, p4RtC *client.Client, entry *p4_v1.ActionProfileGroup) error
- func (P4RtC P4RtCWrapperStruct) InsertActionProfileMember(ctx context.Context, p4RtC *client.Client, entry *p4_v1.ActionProfileMember) error
- func (P4RtC P4RtCWrapperStruct) InsertTableEntry(ctx context.Context, p4RtC *client.Client, entry *p4_v1.TableEntry) error
- func (P4RtC P4RtCWrapperStruct) ModifyActionProfileGroup(ctx context.Context, p4RtC *client.Client, entry *p4_v1.ActionProfileGroup) error
- func (P4RtC P4RtCWrapperStruct) ModifyActionProfileMember(ctx context.Context, p4RtC *client.Client, entry *p4_v1.ActionProfileMember) error
- func (P4RtC P4RtCWrapperStruct) NewActionProfileGroup(p4RtC *client.Client, actionProfile string, groupID uint32, ...) *p4_v1.ActionProfileGroup
- func (P4RtC P4RtCWrapperStruct) NewActionProfileMember(p4RtC *client.Client, actionProfile string, memberID uint32, action string, ...) *p4_v1.ActionProfileMember
- func (P4RtC P4RtCWrapperStruct) NewTableActionDirect(p4RtC *client.Client, action string, params [][]byte) *p4_v1.TableAction
- func (P4RtC P4RtCWrapperStruct) NewTableActionGroup(p4RtC *client.Client, groupID uint32) *p4_v1.TableAction
- func (P4RtC P4RtCWrapperStruct) NewTableEntry(p4RtC *client.Client, table string, mfs map[string]client.MatchInterface, ...) *p4_v1.TableEntry
- type Table
- type UUIDGenerator
- type UpdateTable
Constants ¶
View Source
const ( MAXMODVAL = (4095 - 1) DEFAULT_UUID_CNT_CACHE = 512 PROTO_TCP = 6 PROTO_UDP = 17 )
View Source
const ( DEFAULT_CNIID_CNT_CACHE = 4094 DEFAULT_SVCID_CNT_CACHE = 64 )
Variables ¶
View Source
var Env string
View Source
var (
JsonFilePath = "/share/infra/jsonfiles/"
)
View Source
var Mask = []uint8{1, 2, 4, 8, 16, 32, 64, 128}
Functions ¶
func CheckIPAddress ¶
Checks needed for empty or small strings For MAC the net library checks for len(s) < 14 so no need
func ConfigureTable ¶
func ConfigureTable(ctx context.Context, p4RtC *client.Client, P4w P4RtCWrapper, tablenames []string, tblactionmap map[string][]UpdateTable, actionnames []string, actiontype bool) error
This function calls Insert_table_entry or delete_table_entry based on actiontype flag
func GenerateMask ¶
this function to generate rulemask or ipsetmask for each rule under each ipsetidx
func GetStr ¶
func GetStr(action InterfaceType) string
func Pack32BinaryIP4 ¶
Binary conversion function for IPaddress strings
func PrepareTable ¶
func PrepareTable(tblaction map[string][]UpdateTable, tbl *Table)
This function utilizes the data from the Table struct To prepare UpdateTable struct and then adds each instances to map. TODO - Add all KeyMatch interfaces
Types ¶
type ActionParam ¶
type ActionParam struct {
// contains filtered or unexported fields
}
type IdGenerator ¶
type IdGenerator struct {
// contains filtered or unexported fields
}
func NewIdGenerator ¶
func NewIdGenerator(cni uint32, svc uint32) *IdGenerator
type InterfaceType ¶
type InterfaceType int
const ( HOST InterfaceType = iota PROXY ENDPOINT EXCEPTION )
const ( Insert InterfaceType = iota Delete Update )
type MockP4 ¶
type MockP4 struct {
P4RtCWrapper
}
func (MockP4) DeleteActionProfileGroup ¶
func (MockP4) DeleteActionProfileMember ¶
func (MockP4) DeleteTableEntry ¶
func (MockP4) InsertActionProfileGroup ¶
func (MockP4) InsertActionProfileMember ¶
func (MockP4) InsertTableEntry ¶
func (MockP4) ModifyActionProfileGroup ¶
func (MockP4) ModifyActionProfileMember ¶
func (MockP4) NewActionProfileGroup ¶
func (m MockP4) NewActionProfileGroup(p4RtC *client.Client, actionProfile string, groupID uint32, members []*p4_v1.ActionProfileGroup_Member, size int32) *p4_v1.ActionProfileGroup
func (MockP4) NewActionProfileMember ¶
func (MockP4) NewTableActionDirect ¶
func (MockP4) NewTableActionGroup ¶
func (MockP4) NewTableEntry ¶
func (m MockP4) NewTableEntry(p4RtC *client.Client, table string, mfs map[string]client.MatchInterface, action *p4_v1.TableAction, options *client.TableEntryOptions) *p4_v1.TableEntry
type P4RtCWrapper ¶
type P4RtCWrapper interface { NewTableEntry(p4RtC *client.Client, table string, mfs map[string]client.MatchInterface, action *p4_v1.TableAction, options *client.TableEntryOptions) *p4_v1.TableEntry NewTableActionDirect(p4RtC *client.Client, action string, params [][]byte) *p4_v1.TableAction InsertTableEntry(ctx context.Context, p4RtC *client.Client, entry *p4_v1.TableEntry) error DeleteTableEntry(ctx context.Context, p4RtC *client.Client, entry *p4_v1.TableEntry) error NewActionProfileMember(p4RtC *client.Client, actionProfile string, memberID uint32, action string, params [][]byte) *p4_v1.ActionProfileMember InsertActionProfileMember(ctx context.Context, p4RtC *client.Client, entry *p4_v1.ActionProfileMember) error DeleteActionProfileMember(ctx context.Context, p4RtC *client.Client, entry *p4_v1.ActionProfileMember) error NewActionProfileGroup(p4RtC *client.Client, actionProfile string, groupID uint32, members []*p4_v1.ActionProfileGroup_Member, size int32) *p4_v1.ActionProfileGroup InsertActionProfileGroup(ctx context.Context, p4RtC *client.Client, entry *p4_v1.ActionProfileGroup) error DeleteActionProfileGroup(ctx context.Context, p4RtC *client.Client, entry *p4_v1.ActionProfileGroup) error ModifyActionProfileMember(ctx context.Context, p4RtC *client.Client, entry *p4_v1.ActionProfileMember) error ModifyActionProfileGroup(ctx context.Context, p4RtC *client.Client, entry *p4_v1.ActionProfileGroup) error NewTableActionGroup(p4RtC *client.Client, groupID uint32) *p4_v1.TableAction }
var P4w P4RtCWrapper
func GetP4Wrapper ¶
func GetP4Wrapper(env string) P4RtCWrapper
type P4RtCWrapperStruct ¶
type P4RtCWrapperStruct struct {
P4RtCWrapper
}
func (P4RtCWrapperStruct) DeleteActionProfileGroup ¶
func (P4RtC P4RtCWrapperStruct) DeleteActionProfileGroup(ctx context.Context, p4RtC *client.Client, entry *p4_v1.ActionProfileGroup) error
func (P4RtCWrapperStruct) DeleteActionProfileMember ¶
func (P4RtC P4RtCWrapperStruct) DeleteActionProfileMember(ctx context.Context, p4RtC *client.Client, entry *p4_v1.ActionProfileMember) error
func (P4RtCWrapperStruct) DeleteTableEntry ¶
func (P4RtC P4RtCWrapperStruct) DeleteTableEntry(ctx context.Context, p4RtC *client.Client, entry *p4_v1.TableEntry) error
func (P4RtCWrapperStruct) InsertActionProfileGroup ¶
func (P4RtC P4RtCWrapperStruct) InsertActionProfileGroup(ctx context.Context, p4RtC *client.Client, entry *p4_v1.ActionProfileGroup) error
func (P4RtCWrapperStruct) InsertActionProfileMember ¶
func (P4RtC P4RtCWrapperStruct) InsertActionProfileMember(ctx context.Context, p4RtC *client.Client, entry *p4_v1.ActionProfileMember) error
func (P4RtCWrapperStruct) InsertTableEntry ¶
func (P4RtC P4RtCWrapperStruct) InsertTableEntry(ctx context.Context, p4RtC *client.Client, entry *p4_v1.TableEntry) error
func (P4RtCWrapperStruct) ModifyActionProfileGroup ¶
func (P4RtC P4RtCWrapperStruct) ModifyActionProfileGroup(ctx context.Context, p4RtC *client.Client, entry *p4_v1.ActionProfileGroup) error
func (P4RtCWrapperStruct) ModifyActionProfileMember ¶
func (P4RtC P4RtCWrapperStruct) ModifyActionProfileMember(ctx context.Context, p4RtC *client.Client, entry *p4_v1.ActionProfileMember) error
func (P4RtCWrapperStruct) NewActionProfileGroup ¶
func (P4RtC P4RtCWrapperStruct) NewActionProfileGroup(p4RtC *client.Client, actionProfile string, groupID uint32, members []*p4_v1.ActionProfileGroup_Member, size int32) *p4_v1.ActionProfileGroup
func (P4RtCWrapperStruct) NewActionProfileMember ¶
func (P4RtC P4RtCWrapperStruct) NewActionProfileMember(p4RtC *client.Client, actionProfile string, memberID uint32, action string, params [][]byte) *p4_v1.ActionProfileMember
func (P4RtCWrapperStruct) NewTableActionDirect ¶
func (P4RtC P4RtCWrapperStruct) NewTableActionDirect(p4RtC *client.Client, action string, params [][]byte) *p4_v1.TableAction
func (P4RtCWrapperStruct) NewTableActionGroup ¶
func (P4RtC P4RtCWrapperStruct) NewTableActionGroup(p4RtC *client.Client, groupID uint32) *p4_v1.TableAction
func (P4RtCWrapperStruct) NewTableEntry ¶
func (P4RtC P4RtCWrapperStruct) NewTableEntry(p4RtC *client.Client, table string, mfs map[string]client.MatchInterface, action *p4_v1.TableAction, options *client.TableEntryOptions) *p4_v1.TableEntry
type Table ¶
type Table struct { TableName string `json:"tableName"` ActionName string `json:"actionName"` EntryCount int `json:"entryCount"` KeyCount int `json:"keyCount"` ActionParamCount int `json:"actionParamCount"` KeyMatchType []string `json:"keyMatchType"` KeyName []string `json:"keyName"` Key []interface{} `json:"-"` Action []interface{} `json:"-"` }
Structure reads table details from json file
type UUIDGenerator ¶
type UUIDGenerator struct {
// contains filtered or unexported fields
}
type UpdateTable ¶
type UpdateTable struct {
// contains filtered or unexported fields
}
its a common structure to insert and delete entries from table
Click to show internal directories.
Click to hide internal directories.