本文整理汇总了Golang中github.com/superkkt/cherry/cherryd/openflow.Factory.NewMatch方法的典型用法代码示例。如果您正苦于以下问题:Golang Factory.NewMatch方法的具体用法?Golang Factory.NewMatch怎么用?Golang Factory.NewMatch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/superkkt/cherry/cherryd/openflow.Factory
的用法示例。
在下文中一共展示了Factory.NewMatch方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: sendRemovingAllFlows
func sendRemovingAllFlows(f openflow.Factory, w trans.Writer) error {
match, err := f.NewMatch() // Wildcard
if err != nil {
return err
}
msg, err := f.NewFlowMod(openflow.FlowDelete)
if err != nil {
return err
}
// Wildcard
msg.SetTableID(0xFF)
msg.SetFlowMatch(match)
return w.Write(msg)
}
示例2: setARPSender
func setARPSender(f openflow.Factory, w trans.Writer) error {
match, err := f.NewMatch()
if err != nil {
return err
}
match.SetEtherType(0x0806) // ARP
outPort := openflow.NewOutPort()
outPort.SetController()
action, err := f.NewAction()
if err != nil {
return err
}
action.SetOutPort(outPort)
inst, err := f.NewInstruction()
if err != nil {
return err
}
inst.ApplyAction(action)
flow, err := f.NewFlowMod(openflow.FlowAdd)
if err != nil {
return err
}
// Permanent flow
flow.SetIdleTimeout(0)
flow.SetHardTimeout(0)
flow.SetPriority(100)
flow.SetFlowMatch(match)
flow.SetFlowInstruction(inst)
if err := w.Write(flow); err != nil {
return err
}
return sendBarrierRequest(f, w)
}
示例3: setTableMiss
func (r *of13Session) setTableMiss(f openflow.Factory, w trans.Writer, tableID uint8, inst openflow.Instruction) error {
match, err := f.NewMatch() // Wildcard
if err != nil {
return err
}
msg, err := f.NewFlowMod(openflow.FlowAdd)
if err != nil {
return err
}
// We use MSB to represent whether the flow is table miss or not
msg.SetCookie(0x1 << 63)
msg.SetTableID(tableID)
// Permanent flow entry
msg.SetIdleTimeout(0)
msg.SetHardTimeout(0)
// Table-miss entry should have zero priority
msg.SetPriority(0)
msg.SetFlowMatch(match)
msg.SetFlowInstruction(inst)
return w.Write(msg)
}