本文整理匯總了Golang中github.com/weaveworks/go-odp/odp.DatapathHandle類的典型用法代碼示例。如果您正苦於以下問題:Golang DatapathHandle類的具體用法?Golang DatapathHandle怎麽用?Golang DatapathHandle使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了DatapathHandle類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: printFlowActions
func printFlowActions(as []odp.Action, dp odp.DatapathHandle) error {
outputs := make([]string, 0)
sort.Sort(ActionSlice(as))
for _, a := range as {
switch a := a.(type) {
case odp.OutputAction:
name, err := dp.LookupVportName(a.VportID())
if err != nil {
return err
}
outputs = append(outputs, name)
break
case odp.SetTunnelAction:
printSetTunnelOptions(a)
break
default:
fmt.Printf("%v", a)
break
}
}
if len(outputs) > 0 {
fmt.Printf(" --output=%s", strings.Join(outputs, ","))
}
return nil
}
示例2: printFlowKeys
func printFlowKeys(fks odp.FlowKeys, dp odp.DatapathHandle) error {
for _, fk := range fks {
if fk.Ignored() {
continue
}
switch fk := fk.(type) {
case odp.InPortFlowKey:
name, err := dp.LookupVportName(fk.VportID())
if err != nil {
return err
}
fmt.Printf(" --in-port=%s", name)
break
case odp.EthernetFlowKey:
k := fk.Key()
m := fk.Mask()
printEthAddrOption("eth-src", k.EthSrc[:], m.EthSrc[:])
printEthAddrOption("eth-dst", k.EthDst[:], m.EthDst[:])
break
case odp.TunnelFlowKey:
printTunnelOptions(fk, "tunnel-")
break
default:
fmt.Printf(" %T:%v", fk, fk)
break
}
}
return nil
}
示例3: printVports
func printVports(dpname string, dp odp.DatapathHandle) bool {
vports, err := dp.EnumerateVports()
if err != nil {
return printErr("%s", err)
}
for _, vport := range vports {
printVport("", dpname, vport)
}
return true
}