go.ligato.io/vpp-agent/v3@v3.5.0/proto/ligato/vpp/srv6/models.go (about) 1 // Copyright (c) 2019 Bell Canada, Pantheon Technologies and/or its affiliates. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at: 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package vpp_srv6 16 17 import ( 18 "net" 19 20 "go.ligato.io/vpp-agent/v3/pkg/models" 21 ) 22 23 // ModuleName is the module name used for models. 24 const ( 25 ModuleName = "vpp.srv6" 26 ) 27 28 var ( 29 // ModelLocalSID is registered NB model of LocalSID 30 ModelLocalSID = models.Register(&LocalSID{}, models.Spec{ 31 Module: ModuleName, 32 Type: "localsid", 33 Version: "v2", 34 }, models.WithNameTemplate("{{.Sid}}")) 35 36 // ModelPolicy is registered NB model of Policy 37 ModelPolicy = models.Register(&Policy{}, models.Spec{ 38 Module: ModuleName, 39 Type: "policy", 40 Version: "v2", 41 }, models.WithNameTemplate("{{.Bsid}}")) 42 43 // ModelSteering is registered NB model of Steering 44 ModelSteering = models.Register(&Steering{}, models.Spec{ 45 Module: ModuleName, 46 Type: "steering", 47 Version: "v2", 48 }, models.WithNameTemplate("{{.Name}}")) 49 50 // ModelSRv6Global is registered NB model of SRv6 global config 51 ModelSRv6Global = models.Register(&SRv6Global{}, models.Spec{ 52 Module: ModuleName, 53 Type: "srv6-global", 54 Version: "v2", 55 }) 56 ) 57 58 // SID (in srv6 package) is SRv6's segment id. It is always represented as IPv6 address 59 type SID = net.IP 60 61 // PolicyKey returns the key used in ETCD to store vpp sr policy for vpp instance. 62 func PolicyKey(bsid string) string { 63 return models.Key(&Policy{ 64 Bsid: bsid, 65 }) 66 }