Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vpp.punt: Add support for punt exceptions #1384

Merged
merged 4 commits into from
Jun 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 21 additions & 8 deletions api/models/vpp/punt/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,37 @@ import (
const ModuleName = "vpp"

var (
ModelIPRedirect = models.Register(&IPRedirect{}, models.Spec{
Module: ModuleName,
Type: "ipredirect",
Version: "v2",
}, models.WithNameTemplate(
"l3/{{.L3Protocol}}/tx/{{.TxInterface}}",
))
ModelToHost = models.Register(&ToHost{}, models.Spec{
Module: ModuleName,
Type: "tohost",
Version: "v2",
}, models.WithNameTemplate(
"l3/{{.L3Protocol}}/l4/{{.L4Protocol}}/port/{{.Port}}",
))
ModelIPRedirect = models.Register(&IPRedirect{}, models.Spec{
ModelException = models.Register(&Exception{}, models.Spec{
Module: ModuleName,
Type: "ipredirect",
Type: "exception",
Version: "v2",
}, models.WithNameTemplate(
"l3/{{.L3Protocol}}/tx/{{.TxInterface}}",
"reason/{{.Reason}}",
))
)

// IPRedirectKey returns key representing IP punt redirect configuration.
func IPRedirectKey(l3Proto L3Protocol, txIf string) string {
return models.Key(&IPRedirect{
L3Protocol: l3Proto,
TxInterface: txIf,
})
}

// ToHostKey returns key representing punt to host/socket configuration.
func ToHostKey(l3Proto L3Protocol, l4Proto L4Protocol, port uint32) string {
return models.Key(&ToHost{
Expand All @@ -47,10 +62,8 @@ func ToHostKey(l3Proto L3Protocol, l4Proto L4Protocol, port uint32) string {
})
}

// IPRedirectKey returns key representing IP punt redirect configuration.
func IPRedirectKey(l3Proto L3Protocol, txIf string) string {
return models.Key(&IPRedirect{
L3Protocol: l3Proto,
TxInterface: txIf,
func ExceptionKey(reason string) string {
return models.Key(&Exception{
Reason: reason,
})
}
219 changes: 176 additions & 43 deletions api/models/vpp/punt/punt.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading