diff --git a/go-controller/Makefile b/go-controller/Makefile index 5d73ccd4c2d..48d12cacf66 100644 --- a/go-controller/Makefile +++ b/go-controller/Makefile @@ -23,6 +23,7 @@ CONTAINER_RUNTIME=docker endif CONTAINER_RUNNABLE ?= $(shell $(CONTAINER_RUNTIME) -v > /dev/null 2>&1; echo $$?) OVN_SCHEMA_VERSION ?= v24.03.1 +OVS_VERSION ?= v2.17.0 ifeq ($(NOROOT),TRUE) C_ARGS = -e NOROOT=TRUE else @@ -64,7 +65,7 @@ else RACE=1 hack/test-go.sh endif -modelgen: pkg/nbdb/ovn-nb.ovsschema pkg/sbdb/ovn-sb.ovsschema +modelgen: pkg/nbdb/ovn-nb.ovsschema pkg/sbdb/ovn-sb.ovsschema pkg/vswitchd/vswitch.ovsschema hack/update-modelgen.sh codegen: @@ -85,6 +86,7 @@ clean: rm -rf ${TEST_REPORT_DIR} rm -f ./pkg/nbdb/ovn-nb.ovsschema rm -f ./pkg/sbdb/ovn-sb.ovsschema + rm -f ./pkg/vswitchd/vswitch.ovsschema .PHONY: lint gofmt @@ -108,6 +110,9 @@ pkg/nbdb/ovn-nb.ovsschema: pkg/sbdb/ovn-sb.ovsschema: curl -sSL https://raw.githubusercontent.com/ovn-org/ovn/$(OVN_SCHEMA_VERSION)/ovn-sb.ovsschema -o $@ +pkg/vswitchd/vswitch.ovsschema: + curl -sSL https://raw.githubusercontent.com/openvswitch/ovs/${OVS_VERSION}/vswitchd/vswitch.ovsschema -o $@ + ${TOOLS_OUTPUT_DIR}: mkdir -p ${TOOLS_OUTPUT_DIR} diff --git a/go-controller/cmd/ovn-kube-util/app/ovs-exporter.go b/go-controller/cmd/ovn-kube-util/app/ovs-exporter.go index 5d4e1f65a4e..21bcf7199f5 100644 --- a/go-controller/cmd/ovn-kube-util/app/ovs-exporter.go +++ b/go-controller/cmd/ovn-kube-util/app/ovs-exporter.go @@ -6,6 +6,7 @@ import ( "net/http" "time" + "github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdb" "github.com/ovn-org/ovn-kubernetes/go-controller/pkg/metrics" "github.com/ovn-org/ovn-kubernetes/go-controller/pkg/util" "github.com/prometheus/client_golang/prometheus/promhttp" @@ -13,6 +14,8 @@ import ( kexec "k8s.io/utils/exec" ) +var metricsScrapeInterval int + var OvsExporterCommand = cli.Command{ Name: "ovs-exporter", Usage: "", @@ -21,6 +24,12 @@ var OvsExporterCommand = cli.Command{ Name: "metrics-bind-address", Usage: `The IP address and port for the metrics server to serve on (default ":9310")`, }, + &cli.IntFlag{ + Name: "metrics-interval", + Usage: "The interval in seconds at which ovs metrics are collected", + Value: 30, + Destination: &metricsScrapeInterval, + }, }, Action: func(ctx *cli.Context) error { stopChan := make(chan struct{}) @@ -33,11 +42,17 @@ var OvsExporterCommand = cli.Command{ return err } + // start the ovsdb client for ovs metrics monitoring + ovsClient, err := libovsdb.NewOVSClient(stopChan) + if err != nil { + klog.Errorf("Error initializing ovs client: %v", err) + } + mux := http.NewServeMux() mux.Handle("/metrics", promhttp.Handler()) // register ovs metrics that will be served off of /metrics path - metrics.RegisterStandaloneOvsMetrics(stopChan) + metrics.RegisterStandaloneOvsMetrics(ovsClient, metricsScrapeInterval, stopChan) server := &http.Server{Addr: bindAddress, Handler: mux} go func() { diff --git a/go-controller/cmd/ovnkube/ovnkube.go b/go-controller/cmd/ovnkube/ovnkube.go index c82f5be463c..0c002450a91 100644 --- a/go-controller/cmd/ovnkube/ovnkube.go +++ b/go-controller/cmd/ovnkube/ovnkube.go @@ -560,7 +560,14 @@ func runOvnKube(ctx context.Context, runMode *ovnkubeRunMode, ovnClientset *util // Note: for ovnkube node mode dpu-host no metrics is required as ovs/ovn is not running on the node. if config.OvnKubeNode.Mode != types.NodeModeDPUHost && config.Metrics.OVNMetricsBindAddress != "" { if config.Metrics.ExportOVSMetrics { - metrics.RegisterOvsMetricsWithOvnMetrics(ctx.Done()) + metricsScrapeInterval := 30 + defer cancel() + + ovsClient, err := libovsdb.NewOVSClient(ctx.Done()) + if err != nil { + return fmt.Errorf("failed to initialize libovsdb vswitchd client: %w", err) + } + metrics.RegisterOvsMetricsWithOvnMetrics(ovsClient, metricsScrapeInterval, ctx.Done()) } metrics.RegisterOvnMetrics(ovnClientset.KubeClient, runMode.identity, ctx.Done()) metrics.StartOVNMetricsServer(config.Metrics.OVNMetricsBindAddress, diff --git a/go-controller/hack/update-modelgen.sh b/go-controller/hack/update-modelgen.sh index 00f0156c480..3ba5c6b5bd2 100755 --- a/go-controller/hack/update-modelgen.sh +++ b/go-controller/hack/update-modelgen.sh @@ -18,3 +18,4 @@ fi go generate ./pkg/nbdb go generate ./pkg/sbdb +go generate ./pkg/vswitchd diff --git a/go-controller/pkg/libovsdb/libovsdb.go b/go-controller/pkg/libovsdb/libovsdb.go index 98f8a9c2976..c7aaaa48820 100644 --- a/go-controller/pkg/libovsdb/libovsdb.go +++ b/go-controller/pkg/libovsdb/libovsdb.go @@ -23,6 +23,7 @@ import ( "github.com/ovn-org/ovn-kubernetes/go-controller/pkg/nbdb" "github.com/ovn-org/ovn-kubernetes/go-controller/pkg/sbdb" "github.com/ovn-org/ovn-kubernetes/go-controller/pkg/types" + "github.com/ovn-org/ovn-kubernetes/go-controller/pkg/vswitchd" "github.com/prometheus/client_golang/prometheus" "gopkg.in/fsnotify/fsnotify.v1" "gopkg.in/natefinch/lumberjack.v2" @@ -226,6 +227,47 @@ func NewNBClientWithConfig(cfg config.OvnAuthConfig, promRegistry prometheus.Reg return c, nil } +// NewOVSClient creates a new openvswitch Database client +func NewOVSClient(stopCh <-chan struct{}) (client.Client, error) { + cfg := &config.OvnAuthConfig{ + Scheme: config.OvnDBSchemeUnix, + Address: "unix:/var/run/openvswitch/db.sock", + } + + return NewOVSClientWithConfig(*cfg, stopCh) +} + +func NewOVSClientWithConfig(cfg config.OvnAuthConfig, stopCh <-chan struct{}) (client.Client, error) { + dbModel, err := vswitchd.FullDatabaseModel() + if err != nil { + return nil, err + } + c, err := newClient(cfg, dbModel, stopCh) + if err != nil { + return nil, err + } + ctx, cancel := context.WithTimeout(context.Background(), types.OVSDBTimeout) + go func() { + <-stopCh + cancel() + }() + + _, err = c.Monitor(ctx, + c.NewMonitor( + client.WithTable(&vswitchd.OpenvSwitch{}), + client.WithTable(&vswitchd.Bridge{}), + client.WithTable(&vswitchd.Port{}), + client.WithTable(&vswitchd.Interface{}), + ), + ) + if err != nil { + c.Close() + return nil, err + } + + return c, nil +} + func createTLSConfig(certFile, privKeyFile, caCertFile, serverName string) (*tls.Config, error) { cert, err := tls.LoadX509KeyPair(certFile, privKeyFile) if err != nil { diff --git a/go-controller/pkg/libovsdb/ops/ovs/bridge.go b/go-controller/pkg/libovsdb/ops/ovs/bridge.go new file mode 100644 index 00000000000..21ac97bbc9b --- /dev/null +++ b/go-controller/pkg/libovsdb/ops/ovs/bridge.go @@ -0,0 +1,17 @@ +package ovs + +import ( + "context" + libovsdbclient "github.com/ovn-org/libovsdb/client" + "github.com/ovn-org/ovn-kubernetes/go-controller/pkg/types" + "github.com/ovn-org/ovn-kubernetes/go-controller/pkg/vswitchd" +) + +// ListOVSBridges looks up all bridges from the cache +func ListBridges(ovsClient libovsdbclient.Client) ([]*vswitchd.Bridge, error) { + ctx, cancel := context.WithTimeout(context.Background(), types.OVSDBTimeout) + defer cancel() + searchedBridges := []*vswitchd.Bridge{} + err := ovsClient.List(ctx, &searchedBridges) + return searchedBridges, err +} diff --git a/go-controller/pkg/libovsdb/ops/ovs/interface.go b/go-controller/pkg/libovsdb/ops/ovs/interface.go new file mode 100644 index 00000000000..fe9ff4d0308 --- /dev/null +++ b/go-controller/pkg/libovsdb/ops/ovs/interface.go @@ -0,0 +1,17 @@ +package ovs + +import ( + "context" + libovsdbclient "github.com/ovn-org/libovsdb/client" + "github.com/ovn-org/ovn-kubernetes/go-controller/pkg/types" + "github.com/ovn-org/ovn-kubernetes/go-controller/pkg/vswitchd" +) + +// ListOVSInterfaces looks up all ovs interfaces from the cache +func ListInterfaces(ovsClient libovsdbclient.Client) ([]*vswitchd.Interface, error) { + ctx, cancel := context.WithTimeout(context.Background(), types.OVSDBTimeout) + defer cancel() + searchedInterfaces := []*vswitchd.Interface{} + err := ovsClient.List(ctx, &searchedInterfaces) + return searchedInterfaces, err +} diff --git a/go-controller/pkg/libovsdb/ops/ovs/openvswitch.go b/go-controller/pkg/libovsdb/ops/ovs/openvswitch.go new file mode 100644 index 00000000000..e0dc2613ec8 --- /dev/null +++ b/go-controller/pkg/libovsdb/ops/ovs/openvswitch.go @@ -0,0 +1,25 @@ +package ovs + +import ( + "context" + "fmt" + libovsdbclient "github.com/ovn-org/libovsdb/client" + "github.com/ovn-org/ovn-kubernetes/go-controller/pkg/types" + "github.com/ovn-org/ovn-kubernetes/go-controller/pkg/vswitchd" +) + +// Get OpenvSwitch table from the cache +func GetOpenvSwitchTable(ovsClient libovsdbclient.Client) (*vswitchd.OpenvSwitch, error) { + ctx, cancel := context.WithTimeout(context.Background(), types.OVSDBTimeout) + defer cancel() + openvSwitchTableList := []*vswitchd.OpenvSwitch{} + err := ovsClient.List(ctx, &openvSwitchTableList) + if err != nil { + return nil, err + } + if len(openvSwitchTableList) == 0 { + return nil, fmt.Errorf("no openvSwitch table found") + } + + return openvSwitchTableList[0], err +} diff --git a/go-controller/pkg/metrics/ovs.go b/go-controller/pkg/metrics/ovs.go index 8d43278c940..2f2f99fd2d2 100644 --- a/go-controller/pkg/metrics/ovs.go +++ b/go-controller/pkg/metrics/ovs.go @@ -5,12 +5,13 @@ package metrics import ( "fmt" - "strconv" "strings" "sync" "time" + libovsdbclient "github.com/ovn-org/libovsdb/client" "github.com/ovn-org/ovn-kubernetes/go-controller/pkg/config" + ovsops "github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdb/ops/ovs" "github.com/ovn-org/ovn-kubernetes/go-controller/pkg/util" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/collectors" @@ -271,17 +272,28 @@ var metricOvsTcPolicy = prometheus.NewGauge(prometheus.GaugeOpts{ type ovsClient func(args ...string) (string, string, error) -func getOvsVersionInfo() { - stdout, _, err := util.RunOvsVswitchdAppCtl("version") +func convertToFloat64(val *int) float64 { + var value float64 + if val != nil { + value = float64(*val) + } else { + value = 0 + } + return value +} + +func getOvsVersionInfo(ovsDBClient libovsdbclient.Client) { + openVswitchTable, err := ovsops.GetOpenvSwitchTable(ovsDBClient) if err != nil { - klog.Errorf("Failed to get version information: %s", err.Error()) + klog.Errorf("Failed to get ovsdb openvswitch table :(%v)", err) return } - if !strings.HasPrefix(stdout, "ovs-vswitchd (Open vSwitch)") { - klog.Errorf("Unexpected ovs-appctl version output: %s", stdout) + if openVswitchTable.OVSVersion != nil { + ovsVersion = *openVswitchTable.OVSVersion + } else { + klog.Errorf("Failed to get ovs version information") return } - ovsVersion = strings.Fields(stdout)[3] } // ovsDatapathLookupsMetrics obtains the ovs datapath @@ -414,8 +426,8 @@ func setOvsDatapathMetrics(ovsAppctl ovsClient, datapaths []string) (err error) } // ovsDatapathMetricsUpdater updates the ovs datapath metrics -func ovsDatapathMetricsUpdater(ovsAppctl ovsClient, tickPeriod time.Duration, stopChan <-chan struct{}) { - ticker := time.NewTicker(tickPeriod) +func ovsDatapathMetricsUpdater(ovsAppctl ovsClient, metricsScrapeInterval int, stopChan <-chan struct{}) { + ticker := time.NewTicker(time.Duration(metricsScrapeInterval) * time.Second) defer ticker.Stop() for { select { @@ -435,14 +447,14 @@ func ovsDatapathMetricsUpdater(ovsAppctl ovsClient, tickPeriod time.Duration, st } // ovsBridgeMetricsUpdater updates bridge related metrics -func ovsBridgeMetricsUpdater(ovsVsctl, ovsAppctl ovsClient, tickPeriod time.Duration, stopChan <-chan struct{}) { - ticker := time.NewTicker(tickPeriod) +func ovsBridgeMetricsUpdater(ovsDBClient libovsdbclient.Client, ovsAppctl ovsClient, metricsScrapeInterval int, stopChan <-chan struct{}) { + ticker := time.NewTicker(time.Duration(metricsScrapeInterval) * time.Second) defer ticker.Stop() var err error for { select { case <-ticker.C: - if err = updateOvsBridgeMetrics(ovsVsctl, ovsAppctl); err != nil { + if err = updateOvsBridgeMetrics(ovsDBClient, ovsAppctl); err != nil { klog.Errorf("Getting ovs bridge info failed: %s", err.Error()) } case <-stopChan: @@ -451,42 +463,22 @@ func ovsBridgeMetricsUpdater(ovsVsctl, ovsAppctl ovsClient, tickPeriod time.Dura } } -func updateOvsBridgeMetrics(ovsVsctl, ovsOfctl ovsClient) error { - stdout, stderr, err := ovsVsctl("--no-headings", "--data=bare", - "--format=csv", "--columns=name,port", "list", "Bridge") +func updateOvsBridgeMetrics(ovsDBClient libovsdbclient.Client, ovsOfctl ovsClient) error { + bridgeList, err := ovsops.ListBridges(ovsDBClient) if err != nil { - return fmt.Errorf("unable to update OVS bridge metrics due to failure to get output from"+ - " OVS client stderr(%s) :(%v)", stderr, err) - } - if stderr != "" { - return fmt.Errorf("unable to update OVS bridge metrics because OVS client returned error: %s", stderr) - } - if stdout == "" { - return fmt.Errorf("unable to update OVS bridge metrics because blank output received from OVS client") + return fmt.Errorf("failed to get ovsdb bridge table :(%v)", err) } - - //output will be of format :(br-local,12bc8575-8e1f-4583-b693-ea3b5bf09974 - // 5dc87c46-4d94-4469-9f7a-67ee1c8beb03 620cafe4-bfe5-4a23-8165-4ffc61e7de42) - var bridgeCount int - for _, kvPair := range strings.Split(stdout, "\n") { - if kvPair == "" { - continue - } - fields := strings.Split(kvPair, ",") - bridgeName := fields[0] - ports := strings.Fields(fields[1]) - if bridgeName != "" { - bridgeCount++ - metricOvsBridge.WithLabelValues(bridgeName).Set(1) - metricOvsBridgePortsTotal.WithLabelValues(bridgeName).Set(float64(len(ports))) - count, err := getOvsBridgeOpenFlowsCount(ovsOfctl, bridgeName) - if err != nil { - return err - } - metricOvsBridgeFlowsTotal.WithLabelValues(bridgeName).Set(count) + metricOvsBridgeTotal.Set(float64(len(bridgeList))) + for _, bridge := range bridgeList { + brName := bridge.Name + metricOvsBridge.WithLabelValues(brName).Set(1) + flowsCount, err := getOvsBridgeOpenFlowsCount(ovsOfctl, brName) + if err != nil { + return err } + metricOvsBridgeFlowsTotal.WithLabelValues(brName).Set(flowsCount) + metricOvsBridgePortsTotal.WithLabelValues(brName).Set(float64(len(bridge.Ports))) } - metricOvsBridgeTotal.Set(float64(bridgeCount)) return nil } @@ -516,14 +508,14 @@ func getOvsBridgeOpenFlowsCount(ovsOfctl ovsClient, bridgeName string) (float64, "flow_count field", bridgeName) } -func ovsInterfaceMetricsUpdater(ovsVsctl ovsClient, tickPeriod time.Duration, stopChan <-chan struct{}) { - ticker := time.NewTicker(tickPeriod) +func ovsInterfaceMetricsUpdater(ovsDBClient libovsdbclient.Client, metricsScrapeInterval int, stopChan <-chan struct{}) { + ticker := time.NewTicker(time.Duration(metricsScrapeInterval) * time.Second) defer ticker.Stop() var err error for { select { case <-ticker.C: - if err = updateOvsInterfaceMetrics(ovsVsctl); err != nil { + if err = updateOvsInterfaceMetrics(ovsDBClient); err != nil { klog.Errorf("Updating OVS interface metrics failed: %s", err.Error()) } case <-stopChan: @@ -532,48 +524,29 @@ func ovsInterfaceMetricsUpdater(ovsVsctl ovsClient, tickPeriod time.Duration, st } } -// updateOvsInterfaceMetrics updates the ovs interface metrics obtained from ovs-vsctl --columns= list interface -func updateOvsInterfaceMetrics(ovsVsctl ovsClient) error { - var stdout, stderr string - var err error - - stdout, stderr, err = ovsVsctl("--no-headings", "--data=bare", - "--format=csv", "--columns=link_resets,statistics", "list", "Interface") +// updateOvsInterfaceMetrics updates the ovs interface metrics obtained from vswitchd DB +func updateOvsInterfaceMetrics(ovsDBClient libovsdbclient.Client) error { + interfaceList, err := ovsops.ListInterfaces(ovsDBClient) if err != nil { - return fmt.Errorf("failed to get output for ovs-vsctl list Interface "+ - "stderr(%s) :(%v)", stderr, err) + return fmt.Errorf("failed to get ovsdb interface table :(%v)", err) } - if stderr != "" { - return fmt.Errorf("failed to get OVS interface metrics due to stderr: %s", stderr) - } - if stdout == "" { - return fmt.Errorf("unable to update OVS interface metrics because blank output received from OVS client") + var interfaceStats = []string{ + "rx_dropped", + "rx_errors", + "tx_dropped", + "tx_errors", + "collisions", } - var linkReset, rxDropped, txDropped, rxErr, txErr, collisions, statValue, interfaceCount float64 - for _, kvPair := range strings.Split(stdout, "\n") { - if kvPair == "" { - continue - } - interfaceFieldValues := strings.Split(kvPair, ",") - if len(interfaceFieldValues) != 2 { - return fmt.Errorf("unexpected data format received while trying to get OVS interface metrics: %s", stdout) - } - statValue, err = strconv.ParseFloat(interfaceFieldValues[0], 64) - if err != nil { - return fmt.Errorf("expected string to contain an integer. Failed to get OVS interface metrics: %v", err) - } - linkReset += statValue - interfaceCount++ - // sum statistics - for _, field := range strings.Fields(interfaceFieldValues[1]) { - statsField := strings.Split(field, "=") - statName := strings.TrimSpace(statsField[0]) - statValue, err = strconv.ParseFloat(statsField[1], 64) - if err != nil { - return fmt.Errorf("expected string %q to contain an integer. Failed to get OVS interface metrics: %v", - interfaceFieldValues[1], err) - } + var linkReset, rxDropped, txDropped, rxErr, txErr, collisions, statValue float64 + for _, intf := range interfaceList { + linkReset += convertToFloat64(intf.LinkResets) + + for _, statName := range interfaceStats { + statValue = 0 + if value, ok := intf.Statistics[statName]; ok { + statValue = float64(value) + } switch statName { case "rx_dropped": rxDropped += statValue @@ -588,7 +561,7 @@ func updateOvsInterfaceMetrics(ovsVsctl ovsClient) error { } } } - metricOvsInterfaceTotal.Set(interfaceCount) + metricOvsInterfaceTotal.Set(float64(len(interfaceList))) metricOvsInterfaceResetsTotal.Set(linkReset) metricOvsInterfaceRxDroppedTotal.Set(rxDropped) metricOvsInterfaceTxDroppedTotal.Set(txDropped) @@ -630,8 +603,8 @@ func setOvsMemoryMetrics(ovsVswitchdAppctl ovsClient) (err error) { return nil } -func ovsMemoryMetricsUpdater(ovsVswitchdAppctl ovsClient, tickPeriod time.Duration, stopChan <-chan struct{}) { - ticker := time.NewTicker(tickPeriod) +func ovsMemoryMetricsUpdater(ovsVswitchdAppctl ovsClient, metricsScrapeInterval int, stopChan <-chan struct{}) { + ticker := time.NewTicker(time.Duration(metricsScrapeInterval) * time.Second) defer ticker.Stop() for { select { @@ -645,25 +618,13 @@ func ovsMemoryMetricsUpdater(ovsVswitchdAppctl ovsClient, tickPeriod time.Durati } } -// setOvsHwOffloadMetrics obatains the hw-offlaod, tc-policy -// ovs-vsctl list Open_vSwitch . and updates the corresponding metrics -func setOvsHwOffloadMetrics(ovsVsctl ovsClient) (err error) { - var stdout, stderr string - - defer func() { - if r := recover(); r != nil { - err = fmt.Errorf("recovering from panic while parsing the ovs-vsctl "+ - "list Open_vSwitch . output : %v", r) - } - }() - - stdout, stderr, err = ovsVsctl("--no-headings", "--data=bare", - "--columns=other_config", "list", "Open_vSwitch", ".") +// setOvsHwOffloadMetrics updates the hw-offlaod, tc-policy metrics +// through ovsdb-client from Open_vSwitch table updates +func setOvsHwOffloadMetrics(ovsDBClient libovsdbclient.Client) (err error) { + openVswitchRow, err := ovsops.GetOpenvSwitchTable(ovsDBClient) if err != nil { - return fmt.Errorf("failed to get output from ovs-vsctl list --columns=other_config"+ - "open_vSwitch . stderr(%s) : %v", stderr, err) + return fmt.Errorf("failed to get ovsdb openvswitch table :(%v)", err) } - var hwOffloadValue = "false" var tcPolicyValue = "none" var tcPolicyMap = map[string]float64{ @@ -671,30 +632,31 @@ func setOvsHwOffloadMetrics(ovsVsctl ovsClient) (err error) { "skip_sw": 1, "skip_hw": 2, } - for _, kvPair := range strings.Fields(stdout) { - if strings.HasPrefix(kvPair, "hw-offload=") { - hwOffloadValue = strings.Split(kvPair, "=")[1] - } else if strings.HasPrefix(kvPair, "tc-policy=") { - tcPolicyValue = strings.Split(kvPair, "=")[1] - } - } + // set the hw-offload metric + if val, ok := openVswitchRow.OtherConfig["hw-offload"]; ok { + hwOffloadValue = val + } if hwOffloadValue == "false" { metricOvsHwOffload.Set(0) } else { metricOvsHwOffload.Set(1) } + // set tc-policy metric + if val, ok := openVswitchRow.OtherConfig["tc-policy"]; ok { + tcPolicyValue = val + } metricOvsTcPolicy.Set(tcPolicyMap[tcPolicyValue]) return nil } -func ovsHwOffloadMetricsUpdater(ovsVsctl ovsClient, tickPeriod time.Duration, stopChan <-chan struct{}) { - ticker := time.NewTicker(tickPeriod) +func ovsHwOffloadMetricsUpdater(ovsDBClient libovsdbclient.Client, metricsScrapeInterval int, stopChan <-chan struct{}) { + ticker := time.NewTicker(time.Duration(metricsScrapeInterval) * time.Second) defer ticker.Stop() for { select { case <-ticker.C: - if err := setOvsHwOffloadMetrics(ovsVsctl); err != nil { + if err := setOvsHwOffloadMetrics(ovsDBClient); err != nil { klog.Errorf("Setting ovs hardware offload metrics failed: %s", err.Error()) } case <-stopChan: @@ -868,17 +830,17 @@ var ovsVswitchdCoverageShowMetricsMap = map[string]*metricDetails{ } var registerOvsMetricsOnce sync.Once -func RegisterStandaloneOvsMetrics(stopChan <-chan struct{}) { - registerOvsMetrics(prometheus.DefaultRegisterer, stopChan) +func RegisterStandaloneOvsMetrics(ovsDBClient libovsdbclient.Client, metricsScrapeInterval int, stopChan <-chan struct{}) { + registerOvsMetrics(ovsDBClient, metricsScrapeInterval, prometheus.DefaultRegisterer, stopChan) } -func RegisterOvsMetricsWithOvnMetrics(stopChan <-chan struct{}) { - registerOvsMetrics(ovnRegistry, stopChan) +func RegisterOvsMetricsWithOvnMetrics(ovsDBClient libovsdbclient.Client, metricsScrapeInterval int, stopChan <-chan struct{}) { + registerOvsMetrics(ovsDBClient, metricsScrapeInterval, ovnRegistry, stopChan) } -func registerOvsMetrics(registry prometheus.Registerer, stopChan <-chan struct{}) { +func registerOvsMetrics(ovsDBClient libovsdbclient.Client, metricsScrapeInterval int, registry prometheus.Registerer, stopChan <-chan struct{}) { registerOvsMetricsOnce.Do(func() { - getOvsVersionInfo() + getOvsVersionInfo(ovsDBClient) registry.MustRegister(prometheus.NewGaugeFunc( prometheus.GaugeOpts{ Namespace: MetricOvsNamespace, @@ -941,15 +903,15 @@ func registerOvsMetrics(registry prometheus.Registerer, stopChan <-chan struct{} } // OVS datapath metrics updater - go ovsDatapathMetricsUpdater(util.RunOVSAppctl, 30*time.Second, stopChan) + go ovsDatapathMetricsUpdater(util.RunOVSAppctl, metricsScrapeInterval, stopChan) // OVS bridge metrics updater - go ovsBridgeMetricsUpdater(util.RunOVSVsctl, util.RunOVSOfctl, 30*time.Second, stopChan) + go ovsBridgeMetricsUpdater(ovsDBClient, util.RunOVSOfctl, metricsScrapeInterval, stopChan) // OVS interface metrics updater - go ovsInterfaceMetricsUpdater(util.RunOVSVsctl, 30*time.Second, stopChan) + go ovsInterfaceMetricsUpdater(ovsDBClient, metricsScrapeInterval, stopChan) // OVS memory metrics updater - go ovsMemoryMetricsUpdater(util.RunOvsVswitchdAppCtl, 30*time.Second, stopChan) + go ovsMemoryMetricsUpdater(util.RunOvsVswitchdAppCtl, metricsScrapeInterval, stopChan) // OVS hw Offload metrics updater - go ovsHwOffloadMetricsUpdater(util.RunOVSVsctl, 30*time.Second, stopChan) + go ovsHwOffloadMetricsUpdater(ovsDBClient, metricsScrapeInterval, stopChan) // OVS coverage/show metrics updater. go coverageShowMetricsUpdater(ovsVswitchd, stopChan) }) diff --git a/go-controller/pkg/metrics/ovs_test.go b/go-controller/pkg/metrics/ovs_test.go index 56ea743e42a..d98330d33c4 100644 --- a/go-controller/pkg/metrics/ovs_test.go +++ b/go-controller/pkg/metrics/ovs_test.go @@ -2,11 +2,15 @@ package metrics import ( "fmt" + "sync/atomic" "github.com/ovn-org/ovn-kubernetes/go-controller/pkg/metrics/mocks" "github.com/onsi/ginkgo" "github.com/onsi/gomega" + "github.com/ovn-org/ovn-kubernetes/go-controller/pkg/cryptorand" + libovsdbtest "github.com/ovn-org/ovn-kubernetes/go-controller/pkg/testing/libovsdb" + "github.com/ovn-org/ovn-kubernetes/go-controller/pkg/vswitchd" "github.com/prometheus/client_golang/prometheus" ) @@ -31,16 +35,70 @@ func (c *fakeOVSClient) FakeCall(args ...string) (string, string, error) { return output.stdout, output.stderr, output.err } +// buildNamedUUID builds an id that can be used as a named-uuid +func buildUUID() string { + namedUUIDPrefix := 'u' + namedUUIDCounter := cryptorand.Uint32() + return fmt.Sprintf("%c%010d", namedUUIDPrefix, atomic.AddUint32(&namedUUIDCounter, 1)) +} + const ( ovsAppctlDumpAggregateSampleOutput = "NXST_AGGREGATE reply (xid=0x4): packet_count=856244 byte_count=3464651294 flow_count=30" - ovsVsctlListBridgeOutput = "br-int,porta portb portc\nbr-ex,portd porte" - ovsVsctlListInterfaceOutput = "1,collisions=10 rx_bytes=0 rx_crc_err=0 rx_dropped=5 rx_errors=100 rx_frame_err=0 rx_missed_errors=0 rx_over_err=0 rx_packets=0 tx_bytes=0 tx_dropped=50 tx_errors=20 tx_packets=0\n1,rx_bytes=0 rx_packets=1000 tx_bytes=0 tx_packets=80\n0,collisions=10 rx_bytes=0 rx_crc_err=0 rx_dropped=5 rx_errors=100 rx_frame_err=0 rx_missed_errors=0 rx_over_err=0 rx_packets=0 tx_bytes=0 tx_dropped=50 tx_errors=20 tx_packets=0" ) var _ = ginkgo.Describe("OVS metrics", func() { var stopChan chan struct{} var resetsTotalMock, rxDroppedTotalMock, txDroppedTotalMock *mocks.GaugeMock var rxErrorsTotalMock, txErrorsTotalMock, collisionsTotalMock, bridgeTotalMock *mocks.GaugeMock + var hwOffloadMock, tcPolicyMock *mocks.GaugeMock + + linkResets := 1 + intf1 := vswitchd.Interface{Name: "porta", UUID: buildUUID()} + intf2 := vswitchd.Interface{Name: "portb", UUID: buildUUID()} + intf3 := vswitchd.Interface{Name: "portc", UUID: buildUUID()} + intf4 := vswitchd.Interface{Name: "portd", UUID: buildUUID()} + intf5 := vswitchd.Interface{Name: "porte", UUID: buildUUID()} + port1 := vswitchd.Port{Name: "porta", UUID: buildUUID()} + port2 := vswitchd.Port{Name: "portb", UUID: buildUUID()} + port3 := vswitchd.Port{Name: "portc", UUID: buildUUID()} + port4 := vswitchd.Port{Name: "portd", UUID: buildUUID()} + port5 := vswitchd.Port{Name: "porte", UUID: buildUUID()} + br1 := vswitchd.Bridge{Name: "br-int", UUID: buildUUID()} + br2 := vswitchd.Bridge{Name: "br-ex", UUID: buildUUID()} + + testDB := []libovsdbtest.TestData{ + &vswitchd.Interface{UUID: intf1.UUID, Name: intf1.Name, + LinkResets: &linkResets, Statistics: map[string]int{"collisions": 10, + "rx_bytes": 0, "rx_crc_err": 0, "rx_dropped": 5, "rx_errors": 100, + "rx_frame_err": 0, "rx_missed_errors": 0, "rx_over_err": 0, "rx_packets": 0, + "tx_bytes": 0, "tx_dropped": 50, "tx_errors": 20, "tx_packets": 0}}, + &vswitchd.Interface{UUID: intf2.UUID, Name: intf2.Name, + LinkResets: &linkResets, Statistics: map[string]int{"rx_bytes": 0, + "rx_packets": 1000, "tx_bytes": 0, "tx_packets": 80}}, + &vswitchd.Interface{UUID: intf3.UUID, Name: intf3.Name, + Statistics: map[string]int{"collisions": 10, + "rx_bytes": 0, "rx_crc_err": 0, "rx_dropped": 5, "rx_errors": 100, + "rx_frame_err": 0, "rx_missed_errors": 0, "rx_over_err": 0, "rx_packets": 0, + "tx_bytes": 0, "tx_dropped": 50, "tx_errors": 20, "tx_packets": 0}}, + &vswitchd.Interface{UUID: intf4.UUID, Name: intf4.Name}, + &vswitchd.Interface{UUID: intf5.UUID, Name: intf5.Name}, + &vswitchd.Port{UUID: port1.UUID, Name: port1.Name, + Interfaces: []string{intf1.UUID}}, + &vswitchd.Port{UUID: port2.UUID, Name: port2.Name, + Interfaces: []string{intf2.UUID}}, + &vswitchd.Port{UUID: port3.UUID, Name: port3.Name, + Interfaces: []string{intf3.UUID}}, + &vswitchd.Port{UUID: port4.UUID, Name: port4.Name, + Interfaces: []string{intf4.UUID}}, + &vswitchd.Port{UUID: port5.UUID, Name: port5.Name, + Interfaces: []string{intf5.UUID}}, + &vswitchd.Bridge{UUID: br1.UUID, Name: br1.Name, Ports: []string{port1.UUID, port2.UUID, port3.UUID}}, + &vswitchd.Bridge{UUID: br2.UUID, Name: br2.Name, Ports: []string{port4.UUID, port5.UUID}}, + &vswitchd.OpenvSwitch{UUID: "root-ovs", Bridges: []string{br1.UUID, br2.UUID}}, + } + dbSetup := libovsdbtest.TestSetup{ + OVSData: testDB, + } ginkgo.BeforeEach(func() { // replace all the prom gauges with mocks @@ -53,16 +111,11 @@ var _ = ginkgo.Describe("OVS metrics", func() { close(stopChan) }) - ginkgo.Context("On update bridge metrics", func() { + ginkgo.Context("On update of bridge metrics", func() { ginkgo.It("sets bridge metrics when input valid", func() { - ovsVsctlOutput := []clientOutput{ - { - stdout: ovsVsctlListBridgeOutput, - stderr: "", - err: nil, - }, - } - ovsVsctl := NewFakeOVSClient(ovsVsctlOutput) + + ovsClient, libovsdbCleanup, err := libovsdbtest.NewOVSTestHarness(dbSetup) + gomega.Expect(err).NotTo(gomega.HaveOccurred()) ovsOfctlOutput := []clientOutput{ { stdout: ovsAppctlDumpAggregateSampleOutput, @@ -76,7 +129,7 @@ var _ = ginkgo.Describe("OVS metrics", func() { }, } ovsOfctl := NewFakeOVSClient(ovsOfctlOutput) - err := updateOvsBridgeMetrics(ovsVsctl.FakeCall, ovsOfctl.FakeCall) + err = updateOvsBridgeMetrics(ovsClient, ovsOfctl.FakeCall) gomega.Expect(err).To(gomega.BeNil()) // There is no easy way (that I can think of besides creating my own interface - none exist upstream) to // mock prometheus.gaugevec. @@ -89,59 +142,12 @@ var _ = ginkgo.Describe("OVS metrics", func() { metricOvsBridgeFlowsTotal.Collect(ovsBridgesCh) gomega.Expect(ovsBridgesCh).Should(gomega.HaveLen(6)) gomega.Expect(bridgeTotalMock.GetValue()).Should(gomega.BeNumerically("==", 2)) - }) - - ginkgo.It("returns error when OVS vsctl client returns an error", func() { - ovsVsctlOutput := []clientOutput{ - { - stdout: "", - stderr: "", - err: fmt.Errorf("could not connect to ovsdb"), - }, - } - ovsVsctl := NewFakeOVSClient(ovsVsctlOutput) - ovsAppctl := NewFakeOVSClient([]clientOutput{}) - err := updateOvsBridgeMetrics(ovsVsctl.FakeCall, ovsAppctl.FakeCall) - gomega.Expect(err).ToNot(gomega.BeNil()) - }) - - ginkgo.It("returns error when OVS vsctl client returns non-blank stderr", func() { - ovsVsctlOutput := []clientOutput{ - { - stdout: "", - stderr: "big bad error", - err: nil, - }, - } - ovsVsctl := NewFakeOVSClient(ovsVsctlOutput) - ovsAppctl := NewFakeOVSClient([]clientOutput{}) - err := updateOvsBridgeMetrics(ovsVsctl.FakeCall, ovsAppctl.FakeCall) - gomega.Expect(err).ToNot(gomega.BeNil()) - }) - - ginkgo.It("returns error when OVS vsctl client returns a blank output", func() { - ovsVsctlOutput := []clientOutput{ - { - stdout: "", - stderr: "", - err: nil, - }, - } - ovsVsctl := NewFakeOVSClient(ovsVsctlOutput) - ovsAppctl := NewFakeOVSClient([]clientOutput{}) - err := updateOvsBridgeMetrics(ovsVsctl.FakeCall, ovsAppctl.FakeCall) - gomega.Expect(err).ToNot(gomega.BeNil()) + libovsdbCleanup.Cleanup() }) ginkgo.It("returns error when OVS appctl client returns an error", func() { - ovsVsctlOutput := []clientOutput{ - { - stdout: ovsVsctlListBridgeOutput, - stderr: "", - err: nil, - }, - } - ovsVsctl := NewFakeOVSClient(ovsVsctlOutput) + ovsClient, libovsdbCleanup, err := libovsdbtest.NewOVSTestHarness(dbSetup) + gomega.Expect(err).NotTo(gomega.HaveOccurred()) ovsAppctlOutput := []clientOutput{ { stdout: "", @@ -150,19 +156,14 @@ var _ = ginkgo.Describe("OVS metrics", func() { }, } ovsAppctl := NewFakeOVSClient(ovsAppctlOutput) - err := updateOvsBridgeMetrics(ovsVsctl.FakeCall, ovsAppctl.FakeCall) + err = updateOvsBridgeMetrics(ovsClient, ovsAppctl.FakeCall) gomega.Expect(err).ToNot(gomega.BeNil()) + libovsdbCleanup.Cleanup() }) ginkgo.It("returns error when OVS appctl returns non-blank stderr", func() { - ovsVsctlOutput := []clientOutput{ - { - stdout: ovsVsctlListBridgeOutput, - stderr: "", - err: nil, - }, - } - ovsVsctl := NewFakeOVSClient(ovsVsctlOutput) + ovsClient, libovsdbCleanup, err := libovsdbtest.NewOVSTestHarness(dbSetup) + gomega.Expect(err).NotTo(gomega.HaveOccurred()) ovsAppctlOutput := []clientOutput{ { stdout: "", @@ -171,19 +172,14 @@ var _ = ginkgo.Describe("OVS metrics", func() { }, } ovsAppctl := NewFakeOVSClient(ovsAppctlOutput) - err := updateOvsBridgeMetrics(ovsVsctl.FakeCall, ovsAppctl.FakeCall) + err = updateOvsBridgeMetrics(ovsClient, ovsAppctl.FakeCall) gomega.Expect(err).ToNot(gomega.BeNil()) + libovsdbCleanup.Cleanup() }) ginkgo.It("returns error when OVS appctl client returns a blank output", func() { - ovsVsctlOutput := []clientOutput{ - { - stdout: ovsVsctlListBridgeOutput, - stderr: "", - err: nil, - }, - } - ovsVsctl := NewFakeOVSClient(ovsVsctlOutput) + ovsClient, libovsdbCleanup, err := libovsdbtest.NewOVSTestHarness(dbSetup) + gomega.Expect(err).NotTo(gomega.HaveOccurred()) ovsAppctlOutput := []clientOutput{ { stdout: "", @@ -192,8 +188,9 @@ var _ = ginkgo.Describe("OVS metrics", func() { }, } ovsAppctl := NewFakeOVSClient(ovsAppctlOutput) - err := updateOvsBridgeMetrics(ovsVsctl.FakeCall, ovsAppctl.FakeCall) + err = updateOvsBridgeMetrics(ovsClient, ovsAppctl.FakeCall) gomega.Expect(err).ToNot(gomega.BeNil()) + libovsdbCleanup.Cleanup() }) }) @@ -215,15 +212,9 @@ var _ = ginkgo.Describe("OVS metrics", func() { }) ginkgo.It("sets interface metrics when input is valid", func() { - ovsVsctlOutput := []clientOutput{ - { - stdout: ovsVsctlListInterfaceOutput, - stderr: "", - err: nil, - }, - } - ovsVsctl := NewFakeOVSClient(ovsVsctlOutput) - err := updateOvsInterfaceMetrics(ovsVsctl.FakeCall) + ovsClient, libovsdbCleanup, err := libovsdbtest.NewOVSTestHarness(dbSetup) + gomega.Expect(err).NotTo(gomega.HaveOccurred()) + err = updateOvsInterfaceMetrics(ovsClient) gomega.Expect(err).Should(gomega.BeNil()) gomega.Expect(resetsTotalMock.GetValue()).Should(gomega.BeNumerically("==", 2)) gomega.Expect(rxDroppedTotalMock.GetValue()).Should(gomega.BeNumerically("==", 10)) @@ -231,45 +222,47 @@ var _ = ginkgo.Describe("OVS metrics", func() { gomega.Expect(rxErrorsTotalMock.GetValue()).Should(gomega.BeNumerically("==", 200)) gomega.Expect(txErrorsTotalMock.GetValue()).Should(gomega.BeNumerically("==", 40)) gomega.Expect(collisionsTotalMock.GetValue()).Should(gomega.BeNumerically("==", 20)) + libovsdbCleanup.Cleanup() }) + }) - ginkgo.It("returns error when OVS vsctl client returns an error", func() { - ovsVsctlOutput := []clientOutput{ - { - stdout: "", - stderr: "", - err: fmt.Errorf("could not connect to ovsdb"), - }, - } - ovsVsctl := NewFakeOVSClient(ovsVsctlOutput) - err := updateOvsInterfaceMetrics(ovsVsctl.FakeCall) - gomega.Expect(err).ToNot(gomega.BeNil()) + ginkgo.Context("On update of OVS HwOffload metrics", func() { + ginkgo.BeforeEach(func() { + // replace all the prom gauges with mocks + hwOffloadMock = mocks.NewGaugeMock() + metricOvsHwOffload = hwOffloadMock + tcPolicyMock = mocks.NewGaugeMock() + metricOvsTcPolicy = tcPolicyMock }) - ginkgo.It("returns error when OVS vsctl client returns non-blank stderr", func() { - ovsVsctlOutput := []clientOutput{ - { - stdout: "", - stderr: "", - err: fmt.Errorf("could not connect to ovsdb"), - }, + ginkgo.It("sets Hw offload metrics when input is valid", func() { + testDB := []libovsdbtest.TestData{ + &vswitchd.OpenvSwitch{UUID: "root-ovs", OtherConfig: map[string]string{ + "hw-offload": "true", "tc-policy": "skip_sw"}}, } - ovsVsctl := NewFakeOVSClient(ovsVsctlOutput) - err := updateOvsInterfaceMetrics(ovsVsctl.FakeCall) - gomega.Expect(err).ToNot(gomega.BeNil()) + + dbSetup := libovsdbtest.TestSetup{ + OVSData: testDB, + } + ovsClient, libovsdbCleanup, err := libovsdbtest.NewOVSTestHarness(dbSetup) + gomega.Expect(err).NotTo(gomega.HaveOccurred()) + err = setOvsHwOffloadMetrics(ovsClient) + gomega.Expect(err).Should(gomega.BeNil()) + gomega.Expect(hwOffloadMock.GetValue()).Should(gomega.BeNumerically("==", 1)) + gomega.Expect(tcPolicyMock.GetValue()).Should(gomega.BeNumerically("==", 1)) + libovsdbCleanup.Cleanup() }) + ginkgo.It("returns error when openvswitch table is not found", func() { + testDB := []libovsdbtest.TestData{} - ginkgo.It("returns error when OVS vsctl client returns a blank output", func() { - ovsVsctlOutput := []clientOutput{ - { - stdout: "", - stderr: "", - err: nil, - }, + dbSetup := libovsdbtest.TestSetup{ + OVSData: testDB, } - ovsVsctl := NewFakeOVSClient(ovsVsctlOutput) - err := updateOvsInterfaceMetrics(ovsVsctl.FakeCall) + ovsClient, libovsdbCleanup, err := libovsdbtest.NewOVSTestHarness(dbSetup) + gomega.Expect(err).NotTo(gomega.HaveOccurred()) + err = setOvsHwOffloadMetrics(ovsClient) gomega.Expect(err).ToNot(gomega.BeNil()) + libovsdbCleanup.Cleanup() }) }) }) diff --git a/go-controller/pkg/testing/libovsdb/libovsdb.go b/go-controller/pkg/testing/libovsdb/libovsdb.go index 889fc755a02..98a6dbe6465 100644 --- a/go-controller/pkg/testing/libovsdb/libovsdb.go +++ b/go-controller/pkg/testing/libovsdb/libovsdb.go @@ -33,6 +33,7 @@ import ( "github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdb" "github.com/ovn-org/ovn-kubernetes/go-controller/pkg/nbdb" "github.com/ovn-org/ovn-kubernetes/go-controller/pkg/sbdb" + "github.com/ovn-org/ovn-kubernetes/go-controller/pkg/vswitchd" ) type TestSetup struct { @@ -41,8 +42,9 @@ type TestSetup struct { // addition of invalid data (like duplicate indexes). IgnoreConstraints bool - NBData []TestData - SBData []TestData + NBData []TestData + SBData []TestData + OVSData []TestData } type TestData interface{} @@ -58,9 +60,9 @@ type Context struct { serverStopCh chan struct{} serverWg *sync.WaitGroup - SBServer *TestOvsdbServer - NBServer *TestOvsdbServer - VSServer *TestOvsdbServer + SBServer *TestOvsdbServer + NBServer *TestOvsdbServer + OVSServer *TestOvsdbServer } func newContext() *Context { @@ -126,6 +128,44 @@ func NewSBTestHarness(setup TestSetup, testCtx *Context) (libovsdbclient.Client, return client, testCtx, err } +// NewOVSTestHarness runs OVSDB server and returns corresponding client +func NewOVSTestHarness(setup TestSetup) (libovsdbclient.Client, *Context, error) { + testCtx := newContext() + randBytes := make([]byte, 16) + cryptorand.Read(randBytes) + tmpOVSSocketPath := filepath.Join(os.TempDir(), "ovs-"+hex.EncodeToString(randBytes)) + + cfg := config.OvnAuthConfig{ + Scheme: config.OvnDBSchemeUnix, + Address: "unix:" + tmpOVSSocketPath, + } + + server, err := newOVSServer(cfg, setup.OVSData, false) + if err != nil { + return nil, nil, err + } + + client, err := newOVSClient(cfg, testCtx) + if err != nil { + server.Close() + return nil, nil, err + } + + testCtx.serverWg.Add(1) + go func() { + defer testCtx.serverWg.Done() + <-testCtx.serverStopCh + server.Close() + }() + + if err != nil { + return nil, nil, err + } + testCtx.OVSServer = server + + return client, testCtx, err +} + func newOVSDBTestHarness(serverData []TestData, ignoreConstraints bool, newServer serverBuilderFn, newClient clientBuilderFn, testCtx *Context) (libovsdbclient.Client, *TestOvsdbServer, error) { cfg := config.OvnAuthConfig{ Scheme: config.OvnDBSchemeUnix, @@ -209,6 +249,26 @@ func newNBServer(cfg config.OvnAuthConfig, data []TestData, ignoreConstraints bo return newOVSDBServer(cfg, dbModel, schema, data, ignoreConstraints) } +func newOVSServer(cfg config.OvnAuthConfig, data []TestData, ignoreConstraints bool) (*TestOvsdbServer, error) { + dbModel, err := vswitchd.FullDatabaseModel() + if err != nil { + return nil, err + } + schema := vswitchd.Schema() + return newOVSDBServer(cfg, dbModel, schema, data, ignoreConstraints) +} + +func newOVSClient(cfg config.OvnAuthConfig, testCtx *Context) (libovsdbclient.Client, error) { + stopChan := make(chan struct{}) + ovsClient, err := libovsdb.NewOVSClientWithConfig(cfg, stopChan) + if err != nil { + return nil, err + } + + clientWaitOnCleanup(testCtx, ovsClient, stopChan) + return ovsClient, err +} + func testDataToOperations(dbMod model.DatabaseModel, data []TestData) ([]ovsdb.Operation, error) { m := mapper.NewMapper(dbMod.Schema) newData := copystructure.Must(copystructure.Copy(data)).([]TestData) diff --git a/go-controller/pkg/vswitchd/autoattach.go b/go-controller/pkg/vswitchd/autoattach.go new file mode 100644 index 00000000000..b9655736aa0 --- /dev/null +++ b/go-controller/pkg/vswitchd/autoattach.go @@ -0,0 +1,93 @@ +// Code generated by "libovsdb.modelgen" +// DO NOT EDIT. + +package vswitchd + +import "github.com/ovn-org/libovsdb/model" + +const AutoAttachTable = "AutoAttach" + +// AutoAttach defines an object in AutoAttach table +type AutoAttach struct { + UUID string `ovsdb:"_uuid"` + Mappings map[int]int `ovsdb:"mappings"` + SystemDescription string `ovsdb:"system_description"` + SystemName string `ovsdb:"system_name"` +} + +func (a *AutoAttach) GetUUID() string { + return a.UUID +} + +func (a *AutoAttach) GetMappings() map[int]int { + return a.Mappings +} + +func copyAutoAttachMappings(a map[int]int) map[int]int { + if a == nil { + return nil + } + b := make(map[int]int, len(a)) + for k, v := range a { + b[k] = v + } + return b +} + +func equalAutoAttachMappings(a, b map[int]int) bool { + if (a == nil) != (b == nil) { + return false + } + if len(a) != len(b) { + return false + } + for k, v := range a { + if w, ok := b[k]; !ok || v != w { + return false + } + } + return true +} + +func (a *AutoAttach) GetSystemDescription() string { + return a.SystemDescription +} + +func (a *AutoAttach) GetSystemName() string { + return a.SystemName +} + +func (a *AutoAttach) DeepCopyInto(b *AutoAttach) { + *b = *a + b.Mappings = copyAutoAttachMappings(a.Mappings) +} + +func (a *AutoAttach) DeepCopy() *AutoAttach { + b := new(AutoAttach) + a.DeepCopyInto(b) + return b +} + +func (a *AutoAttach) CloneModelInto(b model.Model) { + c := b.(*AutoAttach) + a.DeepCopyInto(c) +} + +func (a *AutoAttach) CloneModel() model.Model { + return a.DeepCopy() +} + +func (a *AutoAttach) Equals(b *AutoAttach) bool { + return a.UUID == b.UUID && + equalAutoAttachMappings(a.Mappings, b.Mappings) && + a.SystemDescription == b.SystemDescription && + a.SystemName == b.SystemName +} + +func (a *AutoAttach) EqualsModel(b model.Model) bool { + c := b.(*AutoAttach) + return a.Equals(c) +} + +var _ model.CloneableModel = &AutoAttach{} +var _ model.ComparableModel = &AutoAttach{} diff --git a/go-controller/pkg/vswitchd/bridge.go b/go-controller/pkg/vswitchd/bridge.go new file mode 100644 index 00000000000..8953faa3f26 --- /dev/null +++ b/go-controller/pkg/vswitchd/bridge.go @@ -0,0 +1,570 @@ +// Code generated by "libovsdb.modelgen" +// DO NOT EDIT. + +package vswitchd + +import "github.com/ovn-org/libovsdb/model" + +const BridgeTable = "Bridge" + +type ( + BridgeFailMode = string + BridgeProtocols = string +) + +var ( + BridgeFailModeStandalone BridgeFailMode = "standalone" + BridgeFailModeSecure BridgeFailMode = "secure" + BridgeProtocolsOpenflow10 BridgeProtocols = "OpenFlow10" + BridgeProtocolsOpenflow11 BridgeProtocols = "OpenFlow11" + BridgeProtocolsOpenflow12 BridgeProtocols = "OpenFlow12" + BridgeProtocolsOpenflow13 BridgeProtocols = "OpenFlow13" + BridgeProtocolsOpenflow14 BridgeProtocols = "OpenFlow14" + BridgeProtocolsOpenflow15 BridgeProtocols = "OpenFlow15" +) + +// Bridge defines an object in Bridge table +type Bridge struct { + UUID string `ovsdb:"_uuid"` + AutoAttach *string `ovsdb:"auto_attach"` + Controller []string `ovsdb:"controller"` + DatapathID *string `ovsdb:"datapath_id"` + DatapathType string `ovsdb:"datapath_type"` + DatapathVersion string `ovsdb:"datapath_version"` + ExternalIDs map[string]string `ovsdb:"external_ids"` + FailMode *BridgeFailMode `ovsdb:"fail_mode"` + FloodVLANs []int `ovsdb:"flood_vlans"` + FlowTables map[int]string `ovsdb:"flow_tables"` + IPFIX *string `ovsdb:"ipfix"` + McastSnoopingEnable bool `ovsdb:"mcast_snooping_enable"` + Mirrors []string `ovsdb:"mirrors"` + Name string `ovsdb:"name"` + Netflow *string `ovsdb:"netflow"` + OtherConfig map[string]string `ovsdb:"other_config"` + Ports []string `ovsdb:"ports"` + Protocols []BridgeProtocols `ovsdb:"protocols"` + RSTPEnable bool `ovsdb:"rstp_enable"` + RSTPStatus map[string]string `ovsdb:"rstp_status"` + Sflow *string `ovsdb:"sflow"` + Status map[string]string `ovsdb:"status"` + STPEnable bool `ovsdb:"stp_enable"` +} + +func (a *Bridge) GetUUID() string { + return a.UUID +} + +func (a *Bridge) GetAutoAttach() *string { + return a.AutoAttach +} + +func copyBridgeAutoAttach(a *string) *string { + if a == nil { + return nil + } + b := *a + return &b +} + +func equalBridgeAutoAttach(a, b *string) bool { + if (a == nil) != (b == nil) { + return false + } + if a == b { + return true + } + return *a == *b +} + +func (a *Bridge) GetController() []string { + return a.Controller +} + +func copyBridgeController(a []string) []string { + if a == nil { + return nil + } + b := make([]string, len(a)) + copy(b, a) + return b +} + +func equalBridgeController(a, b []string) bool { + if (a == nil) != (b == nil) { + return false + } + if len(a) != len(b) { + return false + } + for i, v := range a { + if b[i] != v { + return false + } + } + return true +} + +func (a *Bridge) GetDatapathID() *string { + return a.DatapathID +} + +func copyBridgeDatapathID(a *string) *string { + if a == nil { + return nil + } + b := *a + return &b +} + +func equalBridgeDatapathID(a, b *string) bool { + if (a == nil) != (b == nil) { + return false + } + if a == b { + return true + } + return *a == *b +} + +func (a *Bridge) GetDatapathType() string { + return a.DatapathType +} + +func (a *Bridge) GetDatapathVersion() string { + return a.DatapathVersion +} + +func (a *Bridge) GetExternalIDs() map[string]string { + return a.ExternalIDs +} + +func copyBridgeExternalIDs(a map[string]string) map[string]string { + if a == nil { + return nil + } + b := make(map[string]string, len(a)) + for k, v := range a { + b[k] = v + } + return b +} + +func equalBridgeExternalIDs(a, b map[string]string) bool { + if (a == nil) != (b == nil) { + return false + } + if len(a) != len(b) { + return false + } + for k, v := range a { + if w, ok := b[k]; !ok || v != w { + return false + } + } + return true +} + +func (a *Bridge) GetFailMode() *BridgeFailMode { + return a.FailMode +} + +func copyBridgeFailMode(a *BridgeFailMode) *BridgeFailMode { + if a == nil { + return nil + } + b := *a + return &b +} + +func equalBridgeFailMode(a, b *BridgeFailMode) bool { + if (a == nil) != (b == nil) { + return false + } + if a == b { + return true + } + return *a == *b +} + +func (a *Bridge) GetFloodVLANs() []int { + return a.FloodVLANs +} + +func copyBridgeFloodVLANs(a []int) []int { + if a == nil { + return nil + } + b := make([]int, len(a)) + copy(b, a) + return b +} + +func equalBridgeFloodVLANs(a, b []int) bool { + if (a == nil) != (b == nil) { + return false + } + if len(a) != len(b) { + return false + } + for i, v := range a { + if b[i] != v { + return false + } + } + return true +} + +func (a *Bridge) GetFlowTables() map[int]string { + return a.FlowTables +} + +func copyBridgeFlowTables(a map[int]string) map[int]string { + if a == nil { + return nil + } + b := make(map[int]string, len(a)) + for k, v := range a { + b[k] = v + } + return b +} + +func equalBridgeFlowTables(a, b map[int]string) bool { + if (a == nil) != (b == nil) { + return false + } + if len(a) != len(b) { + return false + } + for k, v := range a { + if w, ok := b[k]; !ok || v != w { + return false + } + } + return true +} + +func (a *Bridge) GetIPFIX() *string { + return a.IPFIX +} + +func copyBridgeIPFIX(a *string) *string { + if a == nil { + return nil + } + b := *a + return &b +} + +func equalBridgeIPFIX(a, b *string) bool { + if (a == nil) != (b == nil) { + return false + } + if a == b { + return true + } + return *a == *b +} + +func (a *Bridge) GetMcastSnoopingEnable() bool { + return a.McastSnoopingEnable +} + +func (a *Bridge) GetMirrors() []string { + return a.Mirrors +} + +func copyBridgeMirrors(a []string) []string { + if a == nil { + return nil + } + b := make([]string, len(a)) + copy(b, a) + return b +} + +func equalBridgeMirrors(a, b []string) bool { + if (a == nil) != (b == nil) { + return false + } + if len(a) != len(b) { + return false + } + for i, v := range a { + if b[i] != v { + return false + } + } + return true +} + +func (a *Bridge) GetName() string { + return a.Name +} + +func (a *Bridge) GetNetflow() *string { + return a.Netflow +} + +func copyBridgeNetflow(a *string) *string { + if a == nil { + return nil + } + b := *a + return &b +} + +func equalBridgeNetflow(a, b *string) bool { + if (a == nil) != (b == nil) { + return false + } + if a == b { + return true + } + return *a == *b +} + +func (a *Bridge) GetOtherConfig() map[string]string { + return a.OtherConfig +} + +func copyBridgeOtherConfig(a map[string]string) map[string]string { + if a == nil { + return nil + } + b := make(map[string]string, len(a)) + for k, v := range a { + b[k] = v + } + return b +} + +func equalBridgeOtherConfig(a, b map[string]string) bool { + if (a == nil) != (b == nil) { + return false + } + if len(a) != len(b) { + return false + } + for k, v := range a { + if w, ok := b[k]; !ok || v != w { + return false + } + } + return true +} + +func (a *Bridge) GetPorts() []string { + return a.Ports +} + +func copyBridgePorts(a []string) []string { + if a == nil { + return nil + } + b := make([]string, len(a)) + copy(b, a) + return b +} + +func equalBridgePorts(a, b []string) bool { + if (a == nil) != (b == nil) { + return false + } + if len(a) != len(b) { + return false + } + for i, v := range a { + if b[i] != v { + return false + } + } + return true +} + +func (a *Bridge) GetProtocols() []BridgeProtocols { + return a.Protocols +} + +func copyBridgeProtocols(a []BridgeProtocols) []BridgeProtocols { + if a == nil { + return nil + } + b := make([]BridgeProtocols, len(a)) + copy(b, a) + return b +} + +func equalBridgeProtocols(a, b []BridgeProtocols) bool { + if (a == nil) != (b == nil) { + return false + } + if len(a) != len(b) { + return false + } + for i, v := range a { + if b[i] != v { + return false + } + } + return true +} + +func (a *Bridge) GetRSTPEnable() bool { + return a.RSTPEnable +} + +func (a *Bridge) GetRSTPStatus() map[string]string { + return a.RSTPStatus +} + +func copyBridgeRSTPStatus(a map[string]string) map[string]string { + if a == nil { + return nil + } + b := make(map[string]string, len(a)) + for k, v := range a { + b[k] = v + } + return b +} + +func equalBridgeRSTPStatus(a, b map[string]string) bool { + if (a == nil) != (b == nil) { + return false + } + if len(a) != len(b) { + return false + } + for k, v := range a { + if w, ok := b[k]; !ok || v != w { + return false + } + } + return true +} + +func (a *Bridge) GetSflow() *string { + return a.Sflow +} + +func copyBridgeSflow(a *string) *string { + if a == nil { + return nil + } + b := *a + return &b +} + +func equalBridgeSflow(a, b *string) bool { + if (a == nil) != (b == nil) { + return false + } + if a == b { + return true + } + return *a == *b +} + +func (a *Bridge) GetStatus() map[string]string { + return a.Status +} + +func copyBridgeStatus(a map[string]string) map[string]string { + if a == nil { + return nil + } + b := make(map[string]string, len(a)) + for k, v := range a { + b[k] = v + } + return b +} + +func equalBridgeStatus(a, b map[string]string) bool { + if (a == nil) != (b == nil) { + return false + } + if len(a) != len(b) { + return false + } + for k, v := range a { + if w, ok := b[k]; !ok || v != w { + return false + } + } + return true +} + +func (a *Bridge) GetSTPEnable() bool { + return a.STPEnable +} + +func (a *Bridge) DeepCopyInto(b *Bridge) { + *b = *a + b.AutoAttach = copyBridgeAutoAttach(a.AutoAttach) + b.Controller = copyBridgeController(a.Controller) + b.DatapathID = copyBridgeDatapathID(a.DatapathID) + b.ExternalIDs = copyBridgeExternalIDs(a.ExternalIDs) + b.FailMode = copyBridgeFailMode(a.FailMode) + b.FloodVLANs = copyBridgeFloodVLANs(a.FloodVLANs) + b.FlowTables = copyBridgeFlowTables(a.FlowTables) + b.IPFIX = copyBridgeIPFIX(a.IPFIX) + b.Mirrors = copyBridgeMirrors(a.Mirrors) + b.Netflow = copyBridgeNetflow(a.Netflow) + b.OtherConfig = copyBridgeOtherConfig(a.OtherConfig) + b.Ports = copyBridgePorts(a.Ports) + b.Protocols = copyBridgeProtocols(a.Protocols) + b.RSTPStatus = copyBridgeRSTPStatus(a.RSTPStatus) + b.Sflow = copyBridgeSflow(a.Sflow) + b.Status = copyBridgeStatus(a.Status) +} + +func (a *Bridge) DeepCopy() *Bridge { + b := new(Bridge) + a.DeepCopyInto(b) + return b +} + +func (a *Bridge) CloneModelInto(b model.Model) { + c := b.(*Bridge) + a.DeepCopyInto(c) +} + +func (a *Bridge) CloneModel() model.Model { + return a.DeepCopy() +} + +func (a *Bridge) Equals(b *Bridge) bool { + return a.UUID == b.UUID && + equalBridgeAutoAttach(a.AutoAttach, b.AutoAttach) && + equalBridgeController(a.Controller, b.Controller) && + equalBridgeDatapathID(a.DatapathID, b.DatapathID) && + a.DatapathType == b.DatapathType && + a.DatapathVersion == b.DatapathVersion && + equalBridgeExternalIDs(a.ExternalIDs, b.ExternalIDs) && + equalBridgeFailMode(a.FailMode, b.FailMode) && + equalBridgeFloodVLANs(a.FloodVLANs, b.FloodVLANs) && + equalBridgeFlowTables(a.FlowTables, b.FlowTables) && + equalBridgeIPFIX(a.IPFIX, b.IPFIX) && + a.McastSnoopingEnable == b.McastSnoopingEnable && + equalBridgeMirrors(a.Mirrors, b.Mirrors) && + a.Name == b.Name && + equalBridgeNetflow(a.Netflow, b.Netflow) && + equalBridgeOtherConfig(a.OtherConfig, b.OtherConfig) && + equalBridgePorts(a.Ports, b.Ports) && + equalBridgeProtocols(a.Protocols, b.Protocols) && + a.RSTPEnable == b.RSTPEnable && + equalBridgeRSTPStatus(a.RSTPStatus, b.RSTPStatus) && + equalBridgeSflow(a.Sflow, b.Sflow) && + equalBridgeStatus(a.Status, b.Status) && + a.STPEnable == b.STPEnable +} + +func (a *Bridge) EqualsModel(b model.Model) bool { + c := b.(*Bridge) + return a.Equals(c) +} + +var _ model.CloneableModel = &Bridge{} +var _ model.ComparableModel = &Bridge{} diff --git a/go-controller/pkg/vswitchd/controller.go b/go-controller/pkg/vswitchd/controller.go new file mode 100644 index 00000000000..1b38c989bfd --- /dev/null +++ b/go-controller/pkg/vswitchd/controller.go @@ -0,0 +1,475 @@ +// Code generated by "libovsdb.modelgen" +// DO NOT EDIT. + +package vswitchd + +import "github.com/ovn-org/libovsdb/model" + +const ControllerTable = "Controller" + +type ( + ControllerConnectionMode = string + ControllerRole = string + ControllerType = string +) + +var ( + ControllerConnectionModeInBand ControllerConnectionMode = "in-band" + ControllerConnectionModeOutOfBand ControllerConnectionMode = "out-of-band" + ControllerRoleOther ControllerRole = "other" + ControllerRoleMaster ControllerRole = "master" + ControllerRoleSlave ControllerRole = "slave" + ControllerTypePrimary ControllerType = "primary" + ControllerTypeService ControllerType = "service" +) + +// Controller defines an object in Controller table +type Controller struct { + UUID string `ovsdb:"_uuid"` + ConnectionMode *ControllerConnectionMode `ovsdb:"connection_mode"` + ControllerBurstLimit *int `ovsdb:"controller_burst_limit"` + ControllerQueueSize *int `ovsdb:"controller_queue_size"` + ControllerRateLimit *int `ovsdb:"controller_rate_limit"` + EnableAsyncMessages *bool `ovsdb:"enable_async_messages"` + ExternalIDs map[string]string `ovsdb:"external_ids"` + InactivityProbe *int `ovsdb:"inactivity_probe"` + IsConnected bool `ovsdb:"is_connected"` + LocalGateway *string `ovsdb:"local_gateway"` + LocalIP *string `ovsdb:"local_ip"` + LocalNetmask *string `ovsdb:"local_netmask"` + MaxBackoff *int `ovsdb:"max_backoff"` + OtherConfig map[string]string `ovsdb:"other_config"` + Role *ControllerRole `ovsdb:"role"` + Status map[string]string `ovsdb:"status"` + Target string `ovsdb:"target"` + Type *ControllerType `ovsdb:"type"` +} + +func (a *Controller) GetUUID() string { + return a.UUID +} + +func (a *Controller) GetConnectionMode() *ControllerConnectionMode { + return a.ConnectionMode +} + +func copyControllerConnectionMode(a *ControllerConnectionMode) *ControllerConnectionMode { + if a == nil { + return nil + } + b := *a + return &b +} + +func equalControllerConnectionMode(a, b *ControllerConnectionMode) bool { + if (a == nil) != (b == nil) { + return false + } + if a == b { + return true + } + return *a == *b +} + +func (a *Controller) GetControllerBurstLimit() *int { + return a.ControllerBurstLimit +} + +func copyControllerControllerBurstLimit(a *int) *int { + if a == nil { + return nil + } + b := *a + return &b +} + +func equalControllerControllerBurstLimit(a, b *int) bool { + if (a == nil) != (b == nil) { + return false + } + if a == b { + return true + } + return *a == *b +} + +func (a *Controller) GetControllerQueueSize() *int { + return a.ControllerQueueSize +} + +func copyControllerControllerQueueSize(a *int) *int { + if a == nil { + return nil + } + b := *a + return &b +} + +func equalControllerControllerQueueSize(a, b *int) bool { + if (a == nil) != (b == nil) { + return false + } + if a == b { + return true + } + return *a == *b +} + +func (a *Controller) GetControllerRateLimit() *int { + return a.ControllerRateLimit +} + +func copyControllerControllerRateLimit(a *int) *int { + if a == nil { + return nil + } + b := *a + return &b +} + +func equalControllerControllerRateLimit(a, b *int) bool { + if (a == nil) != (b == nil) { + return false + } + if a == b { + return true + } + return *a == *b +} + +func (a *Controller) GetEnableAsyncMessages() *bool { + return a.EnableAsyncMessages +} + +func copyControllerEnableAsyncMessages(a *bool) *bool { + if a == nil { + return nil + } + b := *a + return &b +} + +func equalControllerEnableAsyncMessages(a, b *bool) bool { + if (a == nil) != (b == nil) { + return false + } + if a == b { + return true + } + return *a == *b +} + +func (a *Controller) GetExternalIDs() map[string]string { + return a.ExternalIDs +} + +func copyControllerExternalIDs(a map[string]string) map[string]string { + if a == nil { + return nil + } + b := make(map[string]string, len(a)) + for k, v := range a { + b[k] = v + } + return b +} + +func equalControllerExternalIDs(a, b map[string]string) bool { + if (a == nil) != (b == nil) { + return false + } + if len(a) != len(b) { + return false + } + for k, v := range a { + if w, ok := b[k]; !ok || v != w { + return false + } + } + return true +} + +func (a *Controller) GetInactivityProbe() *int { + return a.InactivityProbe +} + +func copyControllerInactivityProbe(a *int) *int { + if a == nil { + return nil + } + b := *a + return &b +} + +func equalControllerInactivityProbe(a, b *int) bool { + if (a == nil) != (b == nil) { + return false + } + if a == b { + return true + } + return *a == *b +} + +func (a *Controller) GetIsConnected() bool { + return a.IsConnected +} + +func (a *Controller) GetLocalGateway() *string { + return a.LocalGateway +} + +func copyControllerLocalGateway(a *string) *string { + if a == nil { + return nil + } + b := *a + return &b +} + +func equalControllerLocalGateway(a, b *string) bool { + if (a == nil) != (b == nil) { + return false + } + if a == b { + return true + } + return *a == *b +} + +func (a *Controller) GetLocalIP() *string { + return a.LocalIP +} + +func copyControllerLocalIP(a *string) *string { + if a == nil { + return nil + } + b := *a + return &b +} + +func equalControllerLocalIP(a, b *string) bool { + if (a == nil) != (b == nil) { + return false + } + if a == b { + return true + } + return *a == *b +} + +func (a *Controller) GetLocalNetmask() *string { + return a.LocalNetmask +} + +func copyControllerLocalNetmask(a *string) *string { + if a == nil { + return nil + } + b := *a + return &b +} + +func equalControllerLocalNetmask(a, b *string) bool { + if (a == nil) != (b == nil) { + return false + } + if a == b { + return true + } + return *a == *b +} + +func (a *Controller) GetMaxBackoff() *int { + return a.MaxBackoff +} + +func copyControllerMaxBackoff(a *int) *int { + if a == nil { + return nil + } + b := *a + return &b +} + +func equalControllerMaxBackoff(a, b *int) bool { + if (a == nil) != (b == nil) { + return false + } + if a == b { + return true + } + return *a == *b +} + +func (a *Controller) GetOtherConfig() map[string]string { + return a.OtherConfig +} + +func copyControllerOtherConfig(a map[string]string) map[string]string { + if a == nil { + return nil + } + b := make(map[string]string, len(a)) + for k, v := range a { + b[k] = v + } + return b +} + +func equalControllerOtherConfig(a, b map[string]string) bool { + if (a == nil) != (b == nil) { + return false + } + if len(a) != len(b) { + return false + } + for k, v := range a { + if w, ok := b[k]; !ok || v != w { + return false + } + } + return true +} + +func (a *Controller) GetRole() *ControllerRole { + return a.Role +} + +func copyControllerRole(a *ControllerRole) *ControllerRole { + if a == nil { + return nil + } + b := *a + return &b +} + +func equalControllerRole(a, b *ControllerRole) bool { + if (a == nil) != (b == nil) { + return false + } + if a == b { + return true + } + return *a == *b +} + +func (a *Controller) GetStatus() map[string]string { + return a.Status +} + +func copyControllerStatus(a map[string]string) map[string]string { + if a == nil { + return nil + } + b := make(map[string]string, len(a)) + for k, v := range a { + b[k] = v + } + return b +} + +func equalControllerStatus(a, b map[string]string) bool { + if (a == nil) != (b == nil) { + return false + } + if len(a) != len(b) { + return false + } + for k, v := range a { + if w, ok := b[k]; !ok || v != w { + return false + } + } + return true +} + +func (a *Controller) GetTarget() string { + return a.Target +} + +func (a *Controller) GetType() *ControllerType { + return a.Type +} + +func copyControllerType(a *ControllerType) *ControllerType { + if a == nil { + return nil + } + b := *a + return &b +} + +func equalControllerType(a, b *ControllerType) bool { + if (a == nil) != (b == nil) { + return false + } + if a == b { + return true + } + return *a == *b +} + +func (a *Controller) DeepCopyInto(b *Controller) { + *b = *a + b.ConnectionMode = copyControllerConnectionMode(a.ConnectionMode) + b.ControllerBurstLimit = copyControllerControllerBurstLimit(a.ControllerBurstLimit) + b.ControllerQueueSize = copyControllerControllerQueueSize(a.ControllerQueueSize) + b.ControllerRateLimit = copyControllerControllerRateLimit(a.ControllerRateLimit) + b.EnableAsyncMessages = copyControllerEnableAsyncMessages(a.EnableAsyncMessages) + b.ExternalIDs = copyControllerExternalIDs(a.ExternalIDs) + b.InactivityProbe = copyControllerInactivityProbe(a.InactivityProbe) + b.LocalGateway = copyControllerLocalGateway(a.LocalGateway) + b.LocalIP = copyControllerLocalIP(a.LocalIP) + b.LocalNetmask = copyControllerLocalNetmask(a.LocalNetmask) + b.MaxBackoff = copyControllerMaxBackoff(a.MaxBackoff) + b.OtherConfig = copyControllerOtherConfig(a.OtherConfig) + b.Role = copyControllerRole(a.Role) + b.Status = copyControllerStatus(a.Status) + b.Type = copyControllerType(a.Type) +} + +func (a *Controller) DeepCopy() *Controller { + b := new(Controller) + a.DeepCopyInto(b) + return b +} + +func (a *Controller) CloneModelInto(b model.Model) { + c := b.(*Controller) + a.DeepCopyInto(c) +} + +func (a *Controller) CloneModel() model.Model { + return a.DeepCopy() +} + +func (a *Controller) Equals(b *Controller) bool { + return a.UUID == b.UUID && + equalControllerConnectionMode(a.ConnectionMode, b.ConnectionMode) && + equalControllerControllerBurstLimit(a.ControllerBurstLimit, b.ControllerBurstLimit) && + equalControllerControllerQueueSize(a.ControllerQueueSize, b.ControllerQueueSize) && + equalControllerControllerRateLimit(a.ControllerRateLimit, b.ControllerRateLimit) && + equalControllerEnableAsyncMessages(a.EnableAsyncMessages, b.EnableAsyncMessages) && + equalControllerExternalIDs(a.ExternalIDs, b.ExternalIDs) && + equalControllerInactivityProbe(a.InactivityProbe, b.InactivityProbe) && + a.IsConnected == b.IsConnected && + equalControllerLocalGateway(a.LocalGateway, b.LocalGateway) && + equalControllerLocalIP(a.LocalIP, b.LocalIP) && + equalControllerLocalNetmask(a.LocalNetmask, b.LocalNetmask) && + equalControllerMaxBackoff(a.MaxBackoff, b.MaxBackoff) && + equalControllerOtherConfig(a.OtherConfig, b.OtherConfig) && + equalControllerRole(a.Role, b.Role) && + equalControllerStatus(a.Status, b.Status) && + a.Target == b.Target && + equalControllerType(a.Type, b.Type) +} + +func (a *Controller) EqualsModel(b model.Model) bool { + c := b.(*Controller) + return a.Equals(c) +} + +var _ model.CloneableModel = &Controller{} +var _ model.ComparableModel = &Controller{} diff --git a/go-controller/pkg/vswitchd/ct_timeout_policy.go b/go-controller/pkg/vswitchd/ct_timeout_policy.go new file mode 100644 index 00000000000..98bf6904983 --- /dev/null +++ b/go-controller/pkg/vswitchd/ct_timeout_policy.go @@ -0,0 +1,137 @@ +// Code generated by "libovsdb.modelgen" +// DO NOT EDIT. + +package vswitchd + +import "github.com/ovn-org/libovsdb/model" + +const CTTimeoutPolicyTable = "CT_Timeout_Policy" + +type ( + CTTimeoutPolicyTimeouts = string +) + +var ( + CTTimeoutPolicyTimeoutsTCPSynSent CTTimeoutPolicyTimeouts = "tcp_syn_sent" + CTTimeoutPolicyTimeoutsTCPSynRecv CTTimeoutPolicyTimeouts = "tcp_syn_recv" + CTTimeoutPolicyTimeoutsTCPEstablished CTTimeoutPolicyTimeouts = "tcp_established" + CTTimeoutPolicyTimeoutsTCPFinWait CTTimeoutPolicyTimeouts = "tcp_fin_wait" + CTTimeoutPolicyTimeoutsTCPCloseWait CTTimeoutPolicyTimeouts = "tcp_close_wait" + CTTimeoutPolicyTimeoutsTCPLastAck CTTimeoutPolicyTimeouts = "tcp_last_ack" + CTTimeoutPolicyTimeoutsTCPTimeWait CTTimeoutPolicyTimeouts = "tcp_time_wait" + CTTimeoutPolicyTimeoutsTCPClose CTTimeoutPolicyTimeouts = "tcp_close" + CTTimeoutPolicyTimeoutsTCPSynSent2 CTTimeoutPolicyTimeouts = "tcp_syn_sent2" + CTTimeoutPolicyTimeoutsTCPRetransmit CTTimeoutPolicyTimeouts = "tcp_retransmit" + CTTimeoutPolicyTimeoutsTCPUnack CTTimeoutPolicyTimeouts = "tcp_unack" + CTTimeoutPolicyTimeoutsUDPFirst CTTimeoutPolicyTimeouts = "udp_first" + CTTimeoutPolicyTimeoutsUDPSingle CTTimeoutPolicyTimeouts = "udp_single" + CTTimeoutPolicyTimeoutsUDPMultiple CTTimeoutPolicyTimeouts = "udp_multiple" + CTTimeoutPolicyTimeoutsICMPFirst CTTimeoutPolicyTimeouts = "icmp_first" + CTTimeoutPolicyTimeoutsICMPReply CTTimeoutPolicyTimeouts = "icmp_reply" +) + +// CTTimeoutPolicy defines an object in CT_Timeout_Policy table +type CTTimeoutPolicy struct { + UUID string `ovsdb:"_uuid"` + ExternalIDs map[string]string `ovsdb:"external_ids"` + Timeouts map[string]int `ovsdb:"timeouts"` +} + +func (a *CTTimeoutPolicy) GetUUID() string { + return a.UUID +} + +func (a *CTTimeoutPolicy) GetExternalIDs() map[string]string { + return a.ExternalIDs +} + +func copyCTTimeoutPolicyExternalIDs(a map[string]string) map[string]string { + if a == nil { + return nil + } + b := make(map[string]string, len(a)) + for k, v := range a { + b[k] = v + } + return b +} + +func equalCTTimeoutPolicyExternalIDs(a, b map[string]string) bool { + if (a == nil) != (b == nil) { + return false + } + if len(a) != len(b) { + return false + } + for k, v := range a { + if w, ok := b[k]; !ok || v != w { + return false + } + } + return true +} + +func (a *CTTimeoutPolicy) GetTimeouts() map[string]int { + return a.Timeouts +} + +func copyCTTimeoutPolicyTimeouts(a map[string]int) map[string]int { + if a == nil { + return nil + } + b := make(map[string]int, len(a)) + for k, v := range a { + b[k] = v + } + return b +} + +func equalCTTimeoutPolicyTimeouts(a, b map[string]int) bool { + if (a == nil) != (b == nil) { + return false + } + if len(a) != len(b) { + return false + } + for k, v := range a { + if w, ok := b[k]; !ok || v != w { + return false + } + } + return true +} + +func (a *CTTimeoutPolicy) DeepCopyInto(b *CTTimeoutPolicy) { + *b = *a + b.ExternalIDs = copyCTTimeoutPolicyExternalIDs(a.ExternalIDs) + b.Timeouts = copyCTTimeoutPolicyTimeouts(a.Timeouts) +} + +func (a *CTTimeoutPolicy) DeepCopy() *CTTimeoutPolicy { + b := new(CTTimeoutPolicy) + a.DeepCopyInto(b) + return b +} + +func (a *CTTimeoutPolicy) CloneModelInto(b model.Model) { + c := b.(*CTTimeoutPolicy) + a.DeepCopyInto(c) +} + +func (a *CTTimeoutPolicy) CloneModel() model.Model { + return a.DeepCopy() +} + +func (a *CTTimeoutPolicy) Equals(b *CTTimeoutPolicy) bool { + return a.UUID == b.UUID && + equalCTTimeoutPolicyExternalIDs(a.ExternalIDs, b.ExternalIDs) && + equalCTTimeoutPolicyTimeouts(a.Timeouts, b.Timeouts) +} + +func (a *CTTimeoutPolicy) EqualsModel(b model.Model) bool { + c := b.(*CTTimeoutPolicy) + return a.Equals(c) +} + +var _ model.CloneableModel = &CTTimeoutPolicy{} +var _ model.ComparableModel = &CTTimeoutPolicy{} diff --git a/go-controller/pkg/vswitchd/ct_zone.go b/go-controller/pkg/vswitchd/ct_zone.go new file mode 100644 index 00000000000..4eaba845c4d --- /dev/null +++ b/go-controller/pkg/vswitchd/ct_zone.go @@ -0,0 +1,106 @@ +// Code generated by "libovsdb.modelgen" +// DO NOT EDIT. + +package vswitchd + +import "github.com/ovn-org/libovsdb/model" + +const CTZoneTable = "CT_Zone" + +// CTZone defines an object in CT_Zone table +type CTZone struct { + UUID string `ovsdb:"_uuid"` + ExternalIDs map[string]string `ovsdb:"external_ids"` + TimeoutPolicy *string `ovsdb:"timeout_policy"` +} + +func (a *CTZone) GetUUID() string { + return a.UUID +} + +func (a *CTZone) GetExternalIDs() map[string]string { + return a.ExternalIDs +} + +func copyCTZoneExternalIDs(a map[string]string) map[string]string { + if a == nil { + return nil + } + b := make(map[string]string, len(a)) + for k, v := range a { + b[k] = v + } + return b +} + +func equalCTZoneExternalIDs(a, b map[string]string) bool { + if (a == nil) != (b == nil) { + return false + } + if len(a) != len(b) { + return false + } + for k, v := range a { + if w, ok := b[k]; !ok || v != w { + return false + } + } + return true +} + +func (a *CTZone) GetTimeoutPolicy() *string { + return a.TimeoutPolicy +} + +func copyCTZoneTimeoutPolicy(a *string) *string { + if a == nil { + return nil + } + b := *a + return &b +} + +func equalCTZoneTimeoutPolicy(a, b *string) bool { + if (a == nil) != (b == nil) { + return false + } + if a == b { + return true + } + return *a == *b +} + +func (a *CTZone) DeepCopyInto(b *CTZone) { + *b = *a + b.ExternalIDs = copyCTZoneExternalIDs(a.ExternalIDs) + b.TimeoutPolicy = copyCTZoneTimeoutPolicy(a.TimeoutPolicy) +} + +func (a *CTZone) DeepCopy() *CTZone { + b := new(CTZone) + a.DeepCopyInto(b) + return b +} + +func (a *CTZone) CloneModelInto(b model.Model) { + c := b.(*CTZone) + a.DeepCopyInto(c) +} + +func (a *CTZone) CloneModel() model.Model { + return a.DeepCopy() +} + +func (a *CTZone) Equals(b *CTZone) bool { + return a.UUID == b.UUID && + equalCTZoneExternalIDs(a.ExternalIDs, b.ExternalIDs) && + equalCTZoneTimeoutPolicy(a.TimeoutPolicy, b.TimeoutPolicy) +} + +func (a *CTZone) EqualsModel(b model.Model) bool { + c := b.(*CTZone) + return a.Equals(c) +} + +var _ model.CloneableModel = &CTZone{} +var _ model.ComparableModel = &CTZone{} diff --git a/go-controller/pkg/vswitchd/datapath.go b/go-controller/pkg/vswitchd/datapath.go new file mode 100644 index 00000000000..71a995f93e9 --- /dev/null +++ b/go-controller/pkg/vswitchd/datapath.go @@ -0,0 +1,153 @@ +// Code generated by "libovsdb.modelgen" +// DO NOT EDIT. + +package vswitchd + +import "github.com/ovn-org/libovsdb/model" + +const DatapathTable = "Datapath" + +// Datapath defines an object in Datapath table +type Datapath struct { + UUID string `ovsdb:"_uuid"` + Capabilities map[string]string `ovsdb:"capabilities"` + CTZones map[int]string `ovsdb:"ct_zones"` + DatapathVersion string `ovsdb:"datapath_version"` + ExternalIDs map[string]string `ovsdb:"external_ids"` +} + +func (a *Datapath) GetUUID() string { + return a.UUID +} + +func (a *Datapath) GetCapabilities() map[string]string { + return a.Capabilities +} + +func copyDatapathCapabilities(a map[string]string) map[string]string { + if a == nil { + return nil + } + b := make(map[string]string, len(a)) + for k, v := range a { + b[k] = v + } + return b +} + +func equalDatapathCapabilities(a, b map[string]string) bool { + if (a == nil) != (b == nil) { + return false + } + if len(a) != len(b) { + return false + } + for k, v := range a { + if w, ok := b[k]; !ok || v != w { + return false + } + } + return true +} + +func (a *Datapath) GetCTZones() map[int]string { + return a.CTZones +} + +func copyDatapathCTZones(a map[int]string) map[int]string { + if a == nil { + return nil + } + b := make(map[int]string, len(a)) + for k, v := range a { + b[k] = v + } + return b +} + +func equalDatapathCTZones(a, b map[int]string) bool { + if (a == nil) != (b == nil) { + return false + } + if len(a) != len(b) { + return false + } + for k, v := range a { + if w, ok := b[k]; !ok || v != w { + return false + } + } + return true +} + +func (a *Datapath) GetDatapathVersion() string { + return a.DatapathVersion +} + +func (a *Datapath) GetExternalIDs() map[string]string { + return a.ExternalIDs +} + +func copyDatapathExternalIDs(a map[string]string) map[string]string { + if a == nil { + return nil + } + b := make(map[string]string, len(a)) + for k, v := range a { + b[k] = v + } + return b +} + +func equalDatapathExternalIDs(a, b map[string]string) bool { + if (a == nil) != (b == nil) { + return false + } + if len(a) != len(b) { + return false + } + for k, v := range a { + if w, ok := b[k]; !ok || v != w { + return false + } + } + return true +} + +func (a *Datapath) DeepCopyInto(b *Datapath) { + *b = *a + b.Capabilities = copyDatapathCapabilities(a.Capabilities) + b.CTZones = copyDatapathCTZones(a.CTZones) + b.ExternalIDs = copyDatapathExternalIDs(a.ExternalIDs) +} + +func (a *Datapath) DeepCopy() *Datapath { + b := new(Datapath) + a.DeepCopyInto(b) + return b +} + +func (a *Datapath) CloneModelInto(b model.Model) { + c := b.(*Datapath) + a.DeepCopyInto(c) +} + +func (a *Datapath) CloneModel() model.Model { + return a.DeepCopy() +} + +func (a *Datapath) Equals(b *Datapath) bool { + return a.UUID == b.UUID && + equalDatapathCapabilities(a.Capabilities, b.Capabilities) && + equalDatapathCTZones(a.CTZones, b.CTZones) && + a.DatapathVersion == b.DatapathVersion && + equalDatapathExternalIDs(a.ExternalIDs, b.ExternalIDs) +} + +func (a *Datapath) EqualsModel(b model.Model) bool { + c := b.(*Datapath) + return a.Equals(c) +} + +var _ model.CloneableModel = &Datapath{} +var _ model.ComparableModel = &Datapath{} diff --git a/go-controller/pkg/vswitchd/flow_sample_collector_set.go b/go-controller/pkg/vswitchd/flow_sample_collector_set.go new file mode 100644 index 00000000000..2c90f5d4380 --- /dev/null +++ b/go-controller/pkg/vswitchd/flow_sample_collector_set.go @@ -0,0 +1,118 @@ +// Code generated by "libovsdb.modelgen" +// DO NOT EDIT. + +package vswitchd + +import "github.com/ovn-org/libovsdb/model" + +const FlowSampleCollectorSetTable = "Flow_Sample_Collector_Set" + +// FlowSampleCollectorSet defines an object in Flow_Sample_Collector_Set table +type FlowSampleCollectorSet struct { + UUID string `ovsdb:"_uuid"` + Bridge string `ovsdb:"bridge"` + ExternalIDs map[string]string `ovsdb:"external_ids"` + ID int `ovsdb:"id"` + IPFIX *string `ovsdb:"ipfix"` +} + +func (a *FlowSampleCollectorSet) GetUUID() string { + return a.UUID +} + +func (a *FlowSampleCollectorSet) GetBridge() string { + return a.Bridge +} + +func (a *FlowSampleCollectorSet) GetExternalIDs() map[string]string { + return a.ExternalIDs +} + +func copyFlowSampleCollectorSetExternalIDs(a map[string]string) map[string]string { + if a == nil { + return nil + } + b := make(map[string]string, len(a)) + for k, v := range a { + b[k] = v + } + return b +} + +func equalFlowSampleCollectorSetExternalIDs(a, b map[string]string) bool { + if (a == nil) != (b == nil) { + return false + } + if len(a) != len(b) { + return false + } + for k, v := range a { + if w, ok := b[k]; !ok || v != w { + return false + } + } + return true +} + +func (a *FlowSampleCollectorSet) GetID() int { + return a.ID +} + +func (a *FlowSampleCollectorSet) GetIPFIX() *string { + return a.IPFIX +} + +func copyFlowSampleCollectorSetIPFIX(a *string) *string { + if a == nil { + return nil + } + b := *a + return &b +} + +func equalFlowSampleCollectorSetIPFIX(a, b *string) bool { + if (a == nil) != (b == nil) { + return false + } + if a == b { + return true + } + return *a == *b +} + +func (a *FlowSampleCollectorSet) DeepCopyInto(b *FlowSampleCollectorSet) { + *b = *a + b.ExternalIDs = copyFlowSampleCollectorSetExternalIDs(a.ExternalIDs) + b.IPFIX = copyFlowSampleCollectorSetIPFIX(a.IPFIX) +} + +func (a *FlowSampleCollectorSet) DeepCopy() *FlowSampleCollectorSet { + b := new(FlowSampleCollectorSet) + a.DeepCopyInto(b) + return b +} + +func (a *FlowSampleCollectorSet) CloneModelInto(b model.Model) { + c := b.(*FlowSampleCollectorSet) + a.DeepCopyInto(c) +} + +func (a *FlowSampleCollectorSet) CloneModel() model.Model { + return a.DeepCopy() +} + +func (a *FlowSampleCollectorSet) Equals(b *FlowSampleCollectorSet) bool { + return a.UUID == b.UUID && + a.Bridge == b.Bridge && + equalFlowSampleCollectorSetExternalIDs(a.ExternalIDs, b.ExternalIDs) && + a.ID == b.ID && + equalFlowSampleCollectorSetIPFIX(a.IPFIX, b.IPFIX) +} + +func (a *FlowSampleCollectorSet) EqualsModel(b model.Model) bool { + c := b.(*FlowSampleCollectorSet) + return a.Equals(c) +} + +var _ model.CloneableModel = &FlowSampleCollectorSet{} +var _ model.ComparableModel = &FlowSampleCollectorSet{} diff --git a/go-controller/pkg/vswitchd/flow_table.go b/go-controller/pkg/vswitchd/flow_table.go new file mode 100644 index 00000000000..42d49d2f584 --- /dev/null +++ b/go-controller/pkg/vswitchd/flow_table.go @@ -0,0 +1,227 @@ +// Code generated by "libovsdb.modelgen" +// DO NOT EDIT. + +package vswitchd + +import "github.com/ovn-org/libovsdb/model" + +const FlowTableTable = "Flow_Table" + +type ( + FlowTableOverflowPolicy = string +) + +var ( + FlowTableOverflowPolicyRefuse FlowTableOverflowPolicy = "refuse" + FlowTableOverflowPolicyEvict FlowTableOverflowPolicy = "evict" +) + +// FlowTable defines an object in Flow_Table table +type FlowTable struct { + UUID string `ovsdb:"_uuid"` + ExternalIDs map[string]string `ovsdb:"external_ids"` + FlowLimit *int `ovsdb:"flow_limit"` + Groups []string `ovsdb:"groups"` + Name *string `ovsdb:"name"` + OverflowPolicy *FlowTableOverflowPolicy `ovsdb:"overflow_policy"` + Prefixes []string `ovsdb:"prefixes"` +} + +func (a *FlowTable) GetUUID() string { + return a.UUID +} + +func (a *FlowTable) GetExternalIDs() map[string]string { + return a.ExternalIDs +} + +func copyFlowTableExternalIDs(a map[string]string) map[string]string { + if a == nil { + return nil + } + b := make(map[string]string, len(a)) + for k, v := range a { + b[k] = v + } + return b +} + +func equalFlowTableExternalIDs(a, b map[string]string) bool { + if (a == nil) != (b == nil) { + return false + } + if len(a) != len(b) { + return false + } + for k, v := range a { + if w, ok := b[k]; !ok || v != w { + return false + } + } + return true +} + +func (a *FlowTable) GetFlowLimit() *int { + return a.FlowLimit +} + +func copyFlowTableFlowLimit(a *int) *int { + if a == nil { + return nil + } + b := *a + return &b +} + +func equalFlowTableFlowLimit(a, b *int) bool { + if (a == nil) != (b == nil) { + return false + } + if a == b { + return true + } + return *a == *b +} + +func (a *FlowTable) GetGroups() []string { + return a.Groups +} + +func copyFlowTableGroups(a []string) []string { + if a == nil { + return nil + } + b := make([]string, len(a)) + copy(b, a) + return b +} + +func equalFlowTableGroups(a, b []string) bool { + if (a == nil) != (b == nil) { + return false + } + if len(a) != len(b) { + return false + } + for i, v := range a { + if b[i] != v { + return false + } + } + return true +} + +func (a *FlowTable) GetName() *string { + return a.Name +} + +func copyFlowTableName(a *string) *string { + if a == nil { + return nil + } + b := *a + return &b +} + +func equalFlowTableName(a, b *string) bool { + if (a == nil) != (b == nil) { + return false + } + if a == b { + return true + } + return *a == *b +} + +func (a *FlowTable) GetOverflowPolicy() *FlowTableOverflowPolicy { + return a.OverflowPolicy +} + +func copyFlowTableOverflowPolicy(a *FlowTableOverflowPolicy) *FlowTableOverflowPolicy { + if a == nil { + return nil + } + b := *a + return &b +} + +func equalFlowTableOverflowPolicy(a, b *FlowTableOverflowPolicy) bool { + if (a == nil) != (b == nil) { + return false + } + if a == b { + return true + } + return *a == *b +} + +func (a *FlowTable) GetPrefixes() []string { + return a.Prefixes +} + +func copyFlowTablePrefixes(a []string) []string { + if a == nil { + return nil + } + b := make([]string, len(a)) + copy(b, a) + return b +} + +func equalFlowTablePrefixes(a, b []string) bool { + if (a == nil) != (b == nil) { + return false + } + if len(a) != len(b) { + return false + } + for i, v := range a { + if b[i] != v { + return false + } + } + return true +} + +func (a *FlowTable) DeepCopyInto(b *FlowTable) { + *b = *a + b.ExternalIDs = copyFlowTableExternalIDs(a.ExternalIDs) + b.FlowLimit = copyFlowTableFlowLimit(a.FlowLimit) + b.Groups = copyFlowTableGroups(a.Groups) + b.Name = copyFlowTableName(a.Name) + b.OverflowPolicy = copyFlowTableOverflowPolicy(a.OverflowPolicy) + b.Prefixes = copyFlowTablePrefixes(a.Prefixes) +} + +func (a *FlowTable) DeepCopy() *FlowTable { + b := new(FlowTable) + a.DeepCopyInto(b) + return b +} + +func (a *FlowTable) CloneModelInto(b model.Model) { + c := b.(*FlowTable) + a.DeepCopyInto(c) +} + +func (a *FlowTable) CloneModel() model.Model { + return a.DeepCopy() +} + +func (a *FlowTable) Equals(b *FlowTable) bool { + return a.UUID == b.UUID && + equalFlowTableExternalIDs(a.ExternalIDs, b.ExternalIDs) && + equalFlowTableFlowLimit(a.FlowLimit, b.FlowLimit) && + equalFlowTableGroups(a.Groups, b.Groups) && + equalFlowTableName(a.Name, b.Name) && + equalFlowTableOverflowPolicy(a.OverflowPolicy, b.OverflowPolicy) && + equalFlowTablePrefixes(a.Prefixes, b.Prefixes) +} + +func (a *FlowTable) EqualsModel(b model.Model) bool { + c := b.(*FlowTable) + return a.Equals(c) +} + +var _ model.CloneableModel = &FlowTable{} +var _ model.ComparableModel = &FlowTable{} diff --git a/go-controller/pkg/vswitchd/gen.go b/go-controller/pkg/vswitchd/gen.go new file mode 100644 index 00000000000..d7c5e300a67 --- /dev/null +++ b/go-controller/pkg/vswitchd/gen.go @@ -0,0 +1,3 @@ +package vswitchd + +//go:generate modelgen --extended -p vswitchd -o . vswitch.ovsschema diff --git a/go-controller/pkg/vswitchd/interface.go b/go-controller/pkg/vswitchd/interface.go new file mode 100644 index 00000000000..e6f67ba9c77 --- /dev/null +++ b/go-controller/pkg/vswitchd/interface.go @@ -0,0 +1,903 @@ +// Code generated by "libovsdb.modelgen" +// DO NOT EDIT. + +package vswitchd + +import "github.com/ovn-org/libovsdb/model" + +const InterfaceTable = "Interface" + +type ( + InterfaceAdminState = string + InterfaceCFMRemoteOpstate = string + InterfaceDuplex = string + InterfaceLinkState = string +) + +var ( + InterfaceAdminStateUp InterfaceAdminState = "up" + InterfaceAdminStateDown InterfaceAdminState = "down" + InterfaceCFMRemoteOpstateUp InterfaceCFMRemoteOpstate = "up" + InterfaceCFMRemoteOpstateDown InterfaceCFMRemoteOpstate = "down" + InterfaceDuplexHalf InterfaceDuplex = "half" + InterfaceDuplexFull InterfaceDuplex = "full" + InterfaceLinkStateUp InterfaceLinkState = "up" + InterfaceLinkStateDown InterfaceLinkState = "down" +) + +// Interface defines an object in Interface table +type Interface struct { + UUID string `ovsdb:"_uuid"` + AdminState *InterfaceAdminState `ovsdb:"admin_state"` + BFD map[string]string `ovsdb:"bfd"` + BFDStatus map[string]string `ovsdb:"bfd_status"` + CFMFault *bool `ovsdb:"cfm_fault"` + CFMFaultStatus []string `ovsdb:"cfm_fault_status"` + CFMFlapCount *int `ovsdb:"cfm_flap_count"` + CFMHealth *int `ovsdb:"cfm_health"` + CFMMpid *int `ovsdb:"cfm_mpid"` + CFMRemoteMpids []int `ovsdb:"cfm_remote_mpids"` + CFMRemoteOpstate *InterfaceCFMRemoteOpstate `ovsdb:"cfm_remote_opstate"` + Duplex *InterfaceDuplex `ovsdb:"duplex"` + Error *string `ovsdb:"error"` + ExternalIDs map[string]string `ovsdb:"external_ids"` + Ifindex *int `ovsdb:"ifindex"` + IngressPolicingBurst int `ovsdb:"ingress_policing_burst"` + IngressPolicingKpktsBurst int `ovsdb:"ingress_policing_kpkts_burst"` + IngressPolicingKpktsRate int `ovsdb:"ingress_policing_kpkts_rate"` + IngressPolicingRate int `ovsdb:"ingress_policing_rate"` + LACPCurrent *bool `ovsdb:"lacp_current"` + LinkResets *int `ovsdb:"link_resets"` + LinkSpeed *int `ovsdb:"link_speed"` + LinkState *InterfaceLinkState `ovsdb:"link_state"` + LLDP map[string]string `ovsdb:"lldp"` + MAC *string `ovsdb:"mac"` + MACInUse *string `ovsdb:"mac_in_use"` + MTU *int `ovsdb:"mtu"` + MTURequest *int `ovsdb:"mtu_request"` + Name string `ovsdb:"name"` + Ofport *int `ovsdb:"ofport"` + OfportRequest *int `ovsdb:"ofport_request"` + Options map[string]string `ovsdb:"options"` + OtherConfig map[string]string `ovsdb:"other_config"` + Statistics map[string]int `ovsdb:"statistics"` + Status map[string]string `ovsdb:"status"` + Type string `ovsdb:"type"` +} + +func (a *Interface) GetUUID() string { + return a.UUID +} + +func (a *Interface) GetAdminState() *InterfaceAdminState { + return a.AdminState +} + +func copyInterfaceAdminState(a *InterfaceAdminState) *InterfaceAdminState { + if a == nil { + return nil + } + b := *a + return &b +} + +func equalInterfaceAdminState(a, b *InterfaceAdminState) bool { + if (a == nil) != (b == nil) { + return false + } + if a == b { + return true + } + return *a == *b +} + +func (a *Interface) GetBFD() map[string]string { + return a.BFD +} + +func copyInterfaceBFD(a map[string]string) map[string]string { + if a == nil { + return nil + } + b := make(map[string]string, len(a)) + for k, v := range a { + b[k] = v + } + return b +} + +func equalInterfaceBFD(a, b map[string]string) bool { + if (a == nil) != (b == nil) { + return false + } + if len(a) != len(b) { + return false + } + for k, v := range a { + if w, ok := b[k]; !ok || v != w { + return false + } + } + return true +} + +func (a *Interface) GetBFDStatus() map[string]string { + return a.BFDStatus +} + +func copyInterfaceBFDStatus(a map[string]string) map[string]string { + if a == nil { + return nil + } + b := make(map[string]string, len(a)) + for k, v := range a { + b[k] = v + } + return b +} + +func equalInterfaceBFDStatus(a, b map[string]string) bool { + if (a == nil) != (b == nil) { + return false + } + if len(a) != len(b) { + return false + } + for k, v := range a { + if w, ok := b[k]; !ok || v != w { + return false + } + } + return true +} + +func (a *Interface) GetCFMFault() *bool { + return a.CFMFault +} + +func copyInterfaceCFMFault(a *bool) *bool { + if a == nil { + return nil + } + b := *a + return &b +} + +func equalInterfaceCFMFault(a, b *bool) bool { + if (a == nil) != (b == nil) { + return false + } + if a == b { + return true + } + return *a == *b +} + +func (a *Interface) GetCFMFaultStatus() []string { + return a.CFMFaultStatus +} + +func copyInterfaceCFMFaultStatus(a []string) []string { + if a == nil { + return nil + } + b := make([]string, len(a)) + copy(b, a) + return b +} + +func equalInterfaceCFMFaultStatus(a, b []string) bool { + if (a == nil) != (b == nil) { + return false + } + if len(a) != len(b) { + return false + } + for i, v := range a { + if b[i] != v { + return false + } + } + return true +} + +func (a *Interface) GetCFMFlapCount() *int { + return a.CFMFlapCount +} + +func copyInterfaceCFMFlapCount(a *int) *int { + if a == nil { + return nil + } + b := *a + return &b +} + +func equalInterfaceCFMFlapCount(a, b *int) bool { + if (a == nil) != (b == nil) { + return false + } + if a == b { + return true + } + return *a == *b +} + +func (a *Interface) GetCFMHealth() *int { + return a.CFMHealth +} + +func copyInterfaceCFMHealth(a *int) *int { + if a == nil { + return nil + } + b := *a + return &b +} + +func equalInterfaceCFMHealth(a, b *int) bool { + if (a == nil) != (b == nil) { + return false + } + if a == b { + return true + } + return *a == *b +} + +func (a *Interface) GetCFMMpid() *int { + return a.CFMMpid +} + +func copyInterfaceCFMMpid(a *int) *int { + if a == nil { + return nil + } + b := *a + return &b +} + +func equalInterfaceCFMMpid(a, b *int) bool { + if (a == nil) != (b == nil) { + return false + } + if a == b { + return true + } + return *a == *b +} + +func (a *Interface) GetCFMRemoteMpids() []int { + return a.CFMRemoteMpids +} + +func copyInterfaceCFMRemoteMpids(a []int) []int { + if a == nil { + return nil + } + b := make([]int, len(a)) + copy(b, a) + return b +} + +func equalInterfaceCFMRemoteMpids(a, b []int) bool { + if (a == nil) != (b == nil) { + return false + } + if len(a) != len(b) { + return false + } + for i, v := range a { + if b[i] != v { + return false + } + } + return true +} + +func (a *Interface) GetCFMRemoteOpstate() *InterfaceCFMRemoteOpstate { + return a.CFMRemoteOpstate +} + +func copyInterfaceCFMRemoteOpstate(a *InterfaceCFMRemoteOpstate) *InterfaceCFMRemoteOpstate { + if a == nil { + return nil + } + b := *a + return &b +} + +func equalInterfaceCFMRemoteOpstate(a, b *InterfaceCFMRemoteOpstate) bool { + if (a == nil) != (b == nil) { + return false + } + if a == b { + return true + } + return *a == *b +} + +func (a *Interface) GetDuplex() *InterfaceDuplex { + return a.Duplex +} + +func copyInterfaceDuplex(a *InterfaceDuplex) *InterfaceDuplex { + if a == nil { + return nil + } + b := *a + return &b +} + +func equalInterfaceDuplex(a, b *InterfaceDuplex) bool { + if (a == nil) != (b == nil) { + return false + } + if a == b { + return true + } + return *a == *b +} + +func (a *Interface) GetError() *string { + return a.Error +} + +func copyInterfaceError(a *string) *string { + if a == nil { + return nil + } + b := *a + return &b +} + +func equalInterfaceError(a, b *string) bool { + if (a == nil) != (b == nil) { + return false + } + if a == b { + return true + } + return *a == *b +} + +func (a *Interface) GetExternalIDs() map[string]string { + return a.ExternalIDs +} + +func copyInterfaceExternalIDs(a map[string]string) map[string]string { + if a == nil { + return nil + } + b := make(map[string]string, len(a)) + for k, v := range a { + b[k] = v + } + return b +} + +func equalInterfaceExternalIDs(a, b map[string]string) bool { + if (a == nil) != (b == nil) { + return false + } + if len(a) != len(b) { + return false + } + for k, v := range a { + if w, ok := b[k]; !ok || v != w { + return false + } + } + return true +} + +func (a *Interface) GetIfindex() *int { + return a.Ifindex +} + +func copyInterfaceIfindex(a *int) *int { + if a == nil { + return nil + } + b := *a + return &b +} + +func equalInterfaceIfindex(a, b *int) bool { + if (a == nil) != (b == nil) { + return false + } + if a == b { + return true + } + return *a == *b +} + +func (a *Interface) GetIngressPolicingBurst() int { + return a.IngressPolicingBurst +} + +func (a *Interface) GetIngressPolicingKpktsBurst() int { + return a.IngressPolicingKpktsBurst +} + +func (a *Interface) GetIngressPolicingKpktsRate() int { + return a.IngressPolicingKpktsRate +} + +func (a *Interface) GetIngressPolicingRate() int { + return a.IngressPolicingRate +} + +func (a *Interface) GetLACPCurrent() *bool { + return a.LACPCurrent +} + +func copyInterfaceLACPCurrent(a *bool) *bool { + if a == nil { + return nil + } + b := *a + return &b +} + +func equalInterfaceLACPCurrent(a, b *bool) bool { + if (a == nil) != (b == nil) { + return false + } + if a == b { + return true + } + return *a == *b +} + +func (a *Interface) GetLinkResets() *int { + return a.LinkResets +} + +func copyInterfaceLinkResets(a *int) *int { + if a == nil { + return nil + } + b := *a + return &b +} + +func equalInterfaceLinkResets(a, b *int) bool { + if (a == nil) != (b == nil) { + return false + } + if a == b { + return true + } + return *a == *b +} + +func (a *Interface) GetLinkSpeed() *int { + return a.LinkSpeed +} + +func copyInterfaceLinkSpeed(a *int) *int { + if a == nil { + return nil + } + b := *a + return &b +} + +func equalInterfaceLinkSpeed(a, b *int) bool { + if (a == nil) != (b == nil) { + return false + } + if a == b { + return true + } + return *a == *b +} + +func (a *Interface) GetLinkState() *InterfaceLinkState { + return a.LinkState +} + +func copyInterfaceLinkState(a *InterfaceLinkState) *InterfaceLinkState { + if a == nil { + return nil + } + b := *a + return &b +} + +func equalInterfaceLinkState(a, b *InterfaceLinkState) bool { + if (a == nil) != (b == nil) { + return false + } + if a == b { + return true + } + return *a == *b +} + +func (a *Interface) GetLLDP() map[string]string { + return a.LLDP +} + +func copyInterfaceLLDP(a map[string]string) map[string]string { + if a == nil { + return nil + } + b := make(map[string]string, len(a)) + for k, v := range a { + b[k] = v + } + return b +} + +func equalInterfaceLLDP(a, b map[string]string) bool { + if (a == nil) != (b == nil) { + return false + } + if len(a) != len(b) { + return false + } + for k, v := range a { + if w, ok := b[k]; !ok || v != w { + return false + } + } + return true +} + +func (a *Interface) GetMAC() *string { + return a.MAC +} + +func copyInterfaceMAC(a *string) *string { + if a == nil { + return nil + } + b := *a + return &b +} + +func equalInterfaceMAC(a, b *string) bool { + if (a == nil) != (b == nil) { + return false + } + if a == b { + return true + } + return *a == *b +} + +func (a *Interface) GetMACInUse() *string { + return a.MACInUse +} + +func copyInterfaceMACInUse(a *string) *string { + if a == nil { + return nil + } + b := *a + return &b +} + +func equalInterfaceMACInUse(a, b *string) bool { + if (a == nil) != (b == nil) { + return false + } + if a == b { + return true + } + return *a == *b +} + +func (a *Interface) GetMTU() *int { + return a.MTU +} + +func copyInterfaceMTU(a *int) *int { + if a == nil { + return nil + } + b := *a + return &b +} + +func equalInterfaceMTU(a, b *int) bool { + if (a == nil) != (b == nil) { + return false + } + if a == b { + return true + } + return *a == *b +} + +func (a *Interface) GetMTURequest() *int { + return a.MTURequest +} + +func copyInterfaceMTURequest(a *int) *int { + if a == nil { + return nil + } + b := *a + return &b +} + +func equalInterfaceMTURequest(a, b *int) bool { + if (a == nil) != (b == nil) { + return false + } + if a == b { + return true + } + return *a == *b +} + +func (a *Interface) GetName() string { + return a.Name +} + +func (a *Interface) GetOfport() *int { + return a.Ofport +} + +func copyInterfaceOfport(a *int) *int { + if a == nil { + return nil + } + b := *a + return &b +} + +func equalInterfaceOfport(a, b *int) bool { + if (a == nil) != (b == nil) { + return false + } + if a == b { + return true + } + return *a == *b +} + +func (a *Interface) GetOfportRequest() *int { + return a.OfportRequest +} + +func copyInterfaceOfportRequest(a *int) *int { + if a == nil { + return nil + } + b := *a + return &b +} + +func equalInterfaceOfportRequest(a, b *int) bool { + if (a == nil) != (b == nil) { + return false + } + if a == b { + return true + } + return *a == *b +} + +func (a *Interface) GetOptions() map[string]string { + return a.Options +} + +func copyInterfaceOptions(a map[string]string) map[string]string { + if a == nil { + return nil + } + b := make(map[string]string, len(a)) + for k, v := range a { + b[k] = v + } + return b +} + +func equalInterfaceOptions(a, b map[string]string) bool { + if (a == nil) != (b == nil) { + return false + } + if len(a) != len(b) { + return false + } + for k, v := range a { + if w, ok := b[k]; !ok || v != w { + return false + } + } + return true +} + +func (a *Interface) GetOtherConfig() map[string]string { + return a.OtherConfig +} + +func copyInterfaceOtherConfig(a map[string]string) map[string]string { + if a == nil { + return nil + } + b := make(map[string]string, len(a)) + for k, v := range a { + b[k] = v + } + return b +} + +func equalInterfaceOtherConfig(a, b map[string]string) bool { + if (a == nil) != (b == nil) { + return false + } + if len(a) != len(b) { + return false + } + for k, v := range a { + if w, ok := b[k]; !ok || v != w { + return false + } + } + return true +} + +func (a *Interface) GetStatistics() map[string]int { + return a.Statistics +} + +func copyInterfaceStatistics(a map[string]int) map[string]int { + if a == nil { + return nil + } + b := make(map[string]int, len(a)) + for k, v := range a { + b[k] = v + } + return b +} + +func equalInterfaceStatistics(a, b map[string]int) bool { + if (a == nil) != (b == nil) { + return false + } + if len(a) != len(b) { + return false + } + for k, v := range a { + if w, ok := b[k]; !ok || v != w { + return false + } + } + return true +} + +func (a *Interface) GetStatus() map[string]string { + return a.Status +} + +func copyInterfaceStatus(a map[string]string) map[string]string { + if a == nil { + return nil + } + b := make(map[string]string, len(a)) + for k, v := range a { + b[k] = v + } + return b +} + +func equalInterfaceStatus(a, b map[string]string) bool { + if (a == nil) != (b == nil) { + return false + } + if len(a) != len(b) { + return false + } + for k, v := range a { + if w, ok := b[k]; !ok || v != w { + return false + } + } + return true +} + +func (a *Interface) GetType() string { + return a.Type +} + +func (a *Interface) DeepCopyInto(b *Interface) { + *b = *a + b.AdminState = copyInterfaceAdminState(a.AdminState) + b.BFD = copyInterfaceBFD(a.BFD) + b.BFDStatus = copyInterfaceBFDStatus(a.BFDStatus) + b.CFMFault = copyInterfaceCFMFault(a.CFMFault) + b.CFMFaultStatus = copyInterfaceCFMFaultStatus(a.CFMFaultStatus) + b.CFMFlapCount = copyInterfaceCFMFlapCount(a.CFMFlapCount) + b.CFMHealth = copyInterfaceCFMHealth(a.CFMHealth) + b.CFMMpid = copyInterfaceCFMMpid(a.CFMMpid) + b.CFMRemoteMpids = copyInterfaceCFMRemoteMpids(a.CFMRemoteMpids) + b.CFMRemoteOpstate = copyInterfaceCFMRemoteOpstate(a.CFMRemoteOpstate) + b.Duplex = copyInterfaceDuplex(a.Duplex) + b.Error = copyInterfaceError(a.Error) + b.ExternalIDs = copyInterfaceExternalIDs(a.ExternalIDs) + b.Ifindex = copyInterfaceIfindex(a.Ifindex) + b.LACPCurrent = copyInterfaceLACPCurrent(a.LACPCurrent) + b.LinkResets = copyInterfaceLinkResets(a.LinkResets) + b.LinkSpeed = copyInterfaceLinkSpeed(a.LinkSpeed) + b.LinkState = copyInterfaceLinkState(a.LinkState) + b.LLDP = copyInterfaceLLDP(a.LLDP) + b.MAC = copyInterfaceMAC(a.MAC) + b.MACInUse = copyInterfaceMACInUse(a.MACInUse) + b.MTU = copyInterfaceMTU(a.MTU) + b.MTURequest = copyInterfaceMTURequest(a.MTURequest) + b.Ofport = copyInterfaceOfport(a.Ofport) + b.OfportRequest = copyInterfaceOfportRequest(a.OfportRequest) + b.Options = copyInterfaceOptions(a.Options) + b.OtherConfig = copyInterfaceOtherConfig(a.OtherConfig) + b.Statistics = copyInterfaceStatistics(a.Statistics) + b.Status = copyInterfaceStatus(a.Status) +} + +func (a *Interface) DeepCopy() *Interface { + b := new(Interface) + a.DeepCopyInto(b) + return b +} + +func (a *Interface) CloneModelInto(b model.Model) { + c := b.(*Interface) + a.DeepCopyInto(c) +} + +func (a *Interface) CloneModel() model.Model { + return a.DeepCopy() +} + +func (a *Interface) Equals(b *Interface) bool { + return a.UUID == b.UUID && + equalInterfaceAdminState(a.AdminState, b.AdminState) && + equalInterfaceBFD(a.BFD, b.BFD) && + equalInterfaceBFDStatus(a.BFDStatus, b.BFDStatus) && + equalInterfaceCFMFault(a.CFMFault, b.CFMFault) && + equalInterfaceCFMFaultStatus(a.CFMFaultStatus, b.CFMFaultStatus) && + equalInterfaceCFMFlapCount(a.CFMFlapCount, b.CFMFlapCount) && + equalInterfaceCFMHealth(a.CFMHealth, b.CFMHealth) && + equalInterfaceCFMMpid(a.CFMMpid, b.CFMMpid) && + equalInterfaceCFMRemoteMpids(a.CFMRemoteMpids, b.CFMRemoteMpids) && + equalInterfaceCFMRemoteOpstate(a.CFMRemoteOpstate, b.CFMRemoteOpstate) && + equalInterfaceDuplex(a.Duplex, b.Duplex) && + equalInterfaceError(a.Error, b.Error) && + equalInterfaceExternalIDs(a.ExternalIDs, b.ExternalIDs) && + equalInterfaceIfindex(a.Ifindex, b.Ifindex) && + a.IngressPolicingBurst == b.IngressPolicingBurst && + a.IngressPolicingKpktsBurst == b.IngressPolicingKpktsBurst && + a.IngressPolicingKpktsRate == b.IngressPolicingKpktsRate && + a.IngressPolicingRate == b.IngressPolicingRate && + equalInterfaceLACPCurrent(a.LACPCurrent, b.LACPCurrent) && + equalInterfaceLinkResets(a.LinkResets, b.LinkResets) && + equalInterfaceLinkSpeed(a.LinkSpeed, b.LinkSpeed) && + equalInterfaceLinkState(a.LinkState, b.LinkState) && + equalInterfaceLLDP(a.LLDP, b.LLDP) && + equalInterfaceMAC(a.MAC, b.MAC) && + equalInterfaceMACInUse(a.MACInUse, b.MACInUse) && + equalInterfaceMTU(a.MTU, b.MTU) && + equalInterfaceMTURequest(a.MTURequest, b.MTURequest) && + a.Name == b.Name && + equalInterfaceOfport(a.Ofport, b.Ofport) && + equalInterfaceOfportRequest(a.OfportRequest, b.OfportRequest) && + equalInterfaceOptions(a.Options, b.Options) && + equalInterfaceOtherConfig(a.OtherConfig, b.OtherConfig) && + equalInterfaceStatistics(a.Statistics, b.Statistics) && + equalInterfaceStatus(a.Status, b.Status) && + a.Type == b.Type +} + +func (a *Interface) EqualsModel(b model.Model) bool { + c := b.(*Interface) + return a.Equals(c) +} + +var _ model.CloneableModel = &Interface{} +var _ model.ComparableModel = &Interface{} diff --git a/go-controller/pkg/vswitchd/ipfix.go b/go-controller/pkg/vswitchd/ipfix.go new file mode 100644 index 00000000000..72b5d3915c3 --- /dev/null +++ b/go-controller/pkg/vswitchd/ipfix.go @@ -0,0 +1,270 @@ +// Code generated by "libovsdb.modelgen" +// DO NOT EDIT. + +package vswitchd + +import "github.com/ovn-org/libovsdb/model" + +const IPFIXTable = "IPFIX" + +// IPFIX defines an object in IPFIX table +type IPFIX struct { + UUID string `ovsdb:"_uuid"` + CacheActiveTimeout *int `ovsdb:"cache_active_timeout"` + CacheMaxFlows *int `ovsdb:"cache_max_flows"` + ExternalIDs map[string]string `ovsdb:"external_ids"` + ObsDomainID *int `ovsdb:"obs_domain_id"` + ObsPointID *int `ovsdb:"obs_point_id"` + OtherConfig map[string]string `ovsdb:"other_config"` + Sampling *int `ovsdb:"sampling"` + Targets []string `ovsdb:"targets"` +} + +func (a *IPFIX) GetUUID() string { + return a.UUID +} + +func (a *IPFIX) GetCacheActiveTimeout() *int { + return a.CacheActiveTimeout +} + +func copyIPFIXCacheActiveTimeout(a *int) *int { + if a == nil { + return nil + } + b := *a + return &b +} + +func equalIPFIXCacheActiveTimeout(a, b *int) bool { + if (a == nil) != (b == nil) { + return false + } + if a == b { + return true + } + return *a == *b +} + +func (a *IPFIX) GetCacheMaxFlows() *int { + return a.CacheMaxFlows +} + +func copyIPFIXCacheMaxFlows(a *int) *int { + if a == nil { + return nil + } + b := *a + return &b +} + +func equalIPFIXCacheMaxFlows(a, b *int) bool { + if (a == nil) != (b == nil) { + return false + } + if a == b { + return true + } + return *a == *b +} + +func (a *IPFIX) GetExternalIDs() map[string]string { + return a.ExternalIDs +} + +func copyIPFIXExternalIDs(a map[string]string) map[string]string { + if a == nil { + return nil + } + b := make(map[string]string, len(a)) + for k, v := range a { + b[k] = v + } + return b +} + +func equalIPFIXExternalIDs(a, b map[string]string) bool { + if (a == nil) != (b == nil) { + return false + } + if len(a) != len(b) { + return false + } + for k, v := range a { + if w, ok := b[k]; !ok || v != w { + return false + } + } + return true +} + +func (a *IPFIX) GetObsDomainID() *int { + return a.ObsDomainID +} + +func copyIPFIXObsDomainID(a *int) *int { + if a == nil { + return nil + } + b := *a + return &b +} + +func equalIPFIXObsDomainID(a, b *int) bool { + if (a == nil) != (b == nil) { + return false + } + if a == b { + return true + } + return *a == *b +} + +func (a *IPFIX) GetObsPointID() *int { + return a.ObsPointID +} + +func copyIPFIXObsPointID(a *int) *int { + if a == nil { + return nil + } + b := *a + return &b +} + +func equalIPFIXObsPointID(a, b *int) bool { + if (a == nil) != (b == nil) { + return false + } + if a == b { + return true + } + return *a == *b +} + +func (a *IPFIX) GetOtherConfig() map[string]string { + return a.OtherConfig +} + +func copyIPFIXOtherConfig(a map[string]string) map[string]string { + if a == nil { + return nil + } + b := make(map[string]string, len(a)) + for k, v := range a { + b[k] = v + } + return b +} + +func equalIPFIXOtherConfig(a, b map[string]string) bool { + if (a == nil) != (b == nil) { + return false + } + if len(a) != len(b) { + return false + } + for k, v := range a { + if w, ok := b[k]; !ok || v != w { + return false + } + } + return true +} + +func (a *IPFIX) GetSampling() *int { + return a.Sampling +} + +func copyIPFIXSampling(a *int) *int { + if a == nil { + return nil + } + b := *a + return &b +} + +func equalIPFIXSampling(a, b *int) bool { + if (a == nil) != (b == nil) { + return false + } + if a == b { + return true + } + return *a == *b +} + +func (a *IPFIX) GetTargets() []string { + return a.Targets +} + +func copyIPFIXTargets(a []string) []string { + if a == nil { + return nil + } + b := make([]string, len(a)) + copy(b, a) + return b +} + +func equalIPFIXTargets(a, b []string) bool { + if (a == nil) != (b == nil) { + return false + } + if len(a) != len(b) { + return false + } + for i, v := range a { + if b[i] != v { + return false + } + } + return true +} + +func (a *IPFIX) DeepCopyInto(b *IPFIX) { + *b = *a + b.CacheActiveTimeout = copyIPFIXCacheActiveTimeout(a.CacheActiveTimeout) + b.CacheMaxFlows = copyIPFIXCacheMaxFlows(a.CacheMaxFlows) + b.ExternalIDs = copyIPFIXExternalIDs(a.ExternalIDs) + b.ObsDomainID = copyIPFIXObsDomainID(a.ObsDomainID) + b.ObsPointID = copyIPFIXObsPointID(a.ObsPointID) + b.OtherConfig = copyIPFIXOtherConfig(a.OtherConfig) + b.Sampling = copyIPFIXSampling(a.Sampling) + b.Targets = copyIPFIXTargets(a.Targets) +} + +func (a *IPFIX) DeepCopy() *IPFIX { + b := new(IPFIX) + a.DeepCopyInto(b) + return b +} + +func (a *IPFIX) CloneModelInto(b model.Model) { + c := b.(*IPFIX) + a.DeepCopyInto(c) +} + +func (a *IPFIX) CloneModel() model.Model { + return a.DeepCopy() +} + +func (a *IPFIX) Equals(b *IPFIX) bool { + return a.UUID == b.UUID && + equalIPFIXCacheActiveTimeout(a.CacheActiveTimeout, b.CacheActiveTimeout) && + equalIPFIXCacheMaxFlows(a.CacheMaxFlows, b.CacheMaxFlows) && + equalIPFIXExternalIDs(a.ExternalIDs, b.ExternalIDs) && + equalIPFIXObsDomainID(a.ObsDomainID, b.ObsDomainID) && + equalIPFIXObsPointID(a.ObsPointID, b.ObsPointID) && + equalIPFIXOtherConfig(a.OtherConfig, b.OtherConfig) && + equalIPFIXSampling(a.Sampling, b.Sampling) && + equalIPFIXTargets(a.Targets, b.Targets) +} + +func (a *IPFIX) EqualsModel(b model.Model) bool { + c := b.(*IPFIX) + return a.Equals(c) +} + +var _ model.CloneableModel = &IPFIX{} +var _ model.ComparableModel = &IPFIX{} diff --git a/go-controller/pkg/vswitchd/manager.go b/go-controller/pkg/vswitchd/manager.go new file mode 100644 index 00000000000..ff1df96caa4 --- /dev/null +++ b/go-controller/pkg/vswitchd/manager.go @@ -0,0 +1,243 @@ +// Code generated by "libovsdb.modelgen" +// DO NOT EDIT. + +package vswitchd + +import "github.com/ovn-org/libovsdb/model" + +const ManagerTable = "Manager" + +type ( + ManagerConnectionMode = string +) + +var ( + ManagerConnectionModeInBand ManagerConnectionMode = "in-band" + ManagerConnectionModeOutOfBand ManagerConnectionMode = "out-of-band" +) + +// Manager defines an object in Manager table +type Manager struct { + UUID string `ovsdb:"_uuid"` + ConnectionMode *ManagerConnectionMode `ovsdb:"connection_mode"` + ExternalIDs map[string]string `ovsdb:"external_ids"` + InactivityProbe *int `ovsdb:"inactivity_probe"` + IsConnected bool `ovsdb:"is_connected"` + MaxBackoff *int `ovsdb:"max_backoff"` + OtherConfig map[string]string `ovsdb:"other_config"` + Status map[string]string `ovsdb:"status"` + Target string `ovsdb:"target"` +} + +func (a *Manager) GetUUID() string { + return a.UUID +} + +func (a *Manager) GetConnectionMode() *ManagerConnectionMode { + return a.ConnectionMode +} + +func copyManagerConnectionMode(a *ManagerConnectionMode) *ManagerConnectionMode { + if a == nil { + return nil + } + b := *a + return &b +} + +func equalManagerConnectionMode(a, b *ManagerConnectionMode) bool { + if (a == nil) != (b == nil) { + return false + } + if a == b { + return true + } + return *a == *b +} + +func (a *Manager) GetExternalIDs() map[string]string { + return a.ExternalIDs +} + +func copyManagerExternalIDs(a map[string]string) map[string]string { + if a == nil { + return nil + } + b := make(map[string]string, len(a)) + for k, v := range a { + b[k] = v + } + return b +} + +func equalManagerExternalIDs(a, b map[string]string) bool { + if (a == nil) != (b == nil) { + return false + } + if len(a) != len(b) { + return false + } + for k, v := range a { + if w, ok := b[k]; !ok || v != w { + return false + } + } + return true +} + +func (a *Manager) GetInactivityProbe() *int { + return a.InactivityProbe +} + +func copyManagerInactivityProbe(a *int) *int { + if a == nil { + return nil + } + b := *a + return &b +} + +func equalManagerInactivityProbe(a, b *int) bool { + if (a == nil) != (b == nil) { + return false + } + if a == b { + return true + } + return *a == *b +} + +func (a *Manager) GetIsConnected() bool { + return a.IsConnected +} + +func (a *Manager) GetMaxBackoff() *int { + return a.MaxBackoff +} + +func copyManagerMaxBackoff(a *int) *int { + if a == nil { + return nil + } + b := *a + return &b +} + +func equalManagerMaxBackoff(a, b *int) bool { + if (a == nil) != (b == nil) { + return false + } + if a == b { + return true + } + return *a == *b +} + +func (a *Manager) GetOtherConfig() map[string]string { + return a.OtherConfig +} + +func copyManagerOtherConfig(a map[string]string) map[string]string { + if a == nil { + return nil + } + b := make(map[string]string, len(a)) + for k, v := range a { + b[k] = v + } + return b +} + +func equalManagerOtherConfig(a, b map[string]string) bool { + if (a == nil) != (b == nil) { + return false + } + if len(a) != len(b) { + return false + } + for k, v := range a { + if w, ok := b[k]; !ok || v != w { + return false + } + } + return true +} + +func (a *Manager) GetStatus() map[string]string { + return a.Status +} + +func copyManagerStatus(a map[string]string) map[string]string { + if a == nil { + return nil + } + b := make(map[string]string, len(a)) + for k, v := range a { + b[k] = v + } + return b +} + +func equalManagerStatus(a, b map[string]string) bool { + if (a == nil) != (b == nil) { + return false + } + if len(a) != len(b) { + return false + } + for k, v := range a { + if w, ok := b[k]; !ok || v != w { + return false + } + } + return true +} + +func (a *Manager) GetTarget() string { + return a.Target +} + +func (a *Manager) DeepCopyInto(b *Manager) { + *b = *a + b.ConnectionMode = copyManagerConnectionMode(a.ConnectionMode) + b.ExternalIDs = copyManagerExternalIDs(a.ExternalIDs) + b.InactivityProbe = copyManagerInactivityProbe(a.InactivityProbe) + b.MaxBackoff = copyManagerMaxBackoff(a.MaxBackoff) + b.OtherConfig = copyManagerOtherConfig(a.OtherConfig) + b.Status = copyManagerStatus(a.Status) +} + +func (a *Manager) DeepCopy() *Manager { + b := new(Manager) + a.DeepCopyInto(b) + return b +} + +func (a *Manager) CloneModelInto(b model.Model) { + c := b.(*Manager) + a.DeepCopyInto(c) +} + +func (a *Manager) CloneModel() model.Model { + return a.DeepCopy() +} + +func (a *Manager) Equals(b *Manager) bool { + return a.UUID == b.UUID && + equalManagerConnectionMode(a.ConnectionMode, b.ConnectionMode) && + equalManagerExternalIDs(a.ExternalIDs, b.ExternalIDs) && + equalManagerInactivityProbe(a.InactivityProbe, b.InactivityProbe) && + a.IsConnected == b.IsConnected && + equalManagerMaxBackoff(a.MaxBackoff, b.MaxBackoff) && + equalManagerOtherConfig(a.OtherConfig, b.OtherConfig) && + equalManagerStatus(a.Status, b.Status) && + a.Target == b.Target +} + +func (a *Manager) EqualsModel(b model.Model) bool { + c := b.(*Manager) + return a.Equals(c) +} + +var _ model.CloneableModel = &Manager{} +var _ model.ComparableModel = &Manager{} diff --git a/go-controller/pkg/vswitchd/mirror.go b/go-controller/pkg/vswitchd/mirror.go new file mode 100644 index 00000000000..044455d2537 --- /dev/null +++ b/go-controller/pkg/vswitchd/mirror.go @@ -0,0 +1,294 @@ +// Code generated by "libovsdb.modelgen" +// DO NOT EDIT. + +package vswitchd + +import "github.com/ovn-org/libovsdb/model" + +const MirrorTable = "Mirror" + +// Mirror defines an object in Mirror table +type Mirror struct { + UUID string `ovsdb:"_uuid"` + ExternalIDs map[string]string `ovsdb:"external_ids"` + Name string `ovsdb:"name"` + OutputPort *string `ovsdb:"output_port"` + OutputVLAN *int `ovsdb:"output_vlan"` + SelectAll bool `ovsdb:"select_all"` + SelectDstPort []string `ovsdb:"select_dst_port"` + SelectSrcPort []string `ovsdb:"select_src_port"` + SelectVLAN []int `ovsdb:"select_vlan"` + Snaplen *int `ovsdb:"snaplen"` + Statistics map[string]int `ovsdb:"statistics"` +} + +func (a *Mirror) GetUUID() string { + return a.UUID +} + +func (a *Mirror) GetExternalIDs() map[string]string { + return a.ExternalIDs +} + +func copyMirrorExternalIDs(a map[string]string) map[string]string { + if a == nil { + return nil + } + b := make(map[string]string, len(a)) + for k, v := range a { + b[k] = v + } + return b +} + +func equalMirrorExternalIDs(a, b map[string]string) bool { + if (a == nil) != (b == nil) { + return false + } + if len(a) != len(b) { + return false + } + for k, v := range a { + if w, ok := b[k]; !ok || v != w { + return false + } + } + return true +} + +func (a *Mirror) GetName() string { + return a.Name +} + +func (a *Mirror) GetOutputPort() *string { + return a.OutputPort +} + +func copyMirrorOutputPort(a *string) *string { + if a == nil { + return nil + } + b := *a + return &b +} + +func equalMirrorOutputPort(a, b *string) bool { + if (a == nil) != (b == nil) { + return false + } + if a == b { + return true + } + return *a == *b +} + +func (a *Mirror) GetOutputVLAN() *int { + return a.OutputVLAN +} + +func copyMirrorOutputVLAN(a *int) *int { + if a == nil { + return nil + } + b := *a + return &b +} + +func equalMirrorOutputVLAN(a, b *int) bool { + if (a == nil) != (b == nil) { + return false + } + if a == b { + return true + } + return *a == *b +} + +func (a *Mirror) GetSelectAll() bool { + return a.SelectAll +} + +func (a *Mirror) GetSelectDstPort() []string { + return a.SelectDstPort +} + +func copyMirrorSelectDstPort(a []string) []string { + if a == nil { + return nil + } + b := make([]string, len(a)) + copy(b, a) + return b +} + +func equalMirrorSelectDstPort(a, b []string) bool { + if (a == nil) != (b == nil) { + return false + } + if len(a) != len(b) { + return false + } + for i, v := range a { + if b[i] != v { + return false + } + } + return true +} + +func (a *Mirror) GetSelectSrcPort() []string { + return a.SelectSrcPort +} + +func copyMirrorSelectSrcPort(a []string) []string { + if a == nil { + return nil + } + b := make([]string, len(a)) + copy(b, a) + return b +} + +func equalMirrorSelectSrcPort(a, b []string) bool { + if (a == nil) != (b == nil) { + return false + } + if len(a) != len(b) { + return false + } + for i, v := range a { + if b[i] != v { + return false + } + } + return true +} + +func (a *Mirror) GetSelectVLAN() []int { + return a.SelectVLAN +} + +func copyMirrorSelectVLAN(a []int) []int { + if a == nil { + return nil + } + b := make([]int, len(a)) + copy(b, a) + return b +} + +func equalMirrorSelectVLAN(a, b []int) bool { + if (a == nil) != (b == nil) { + return false + } + if len(a) != len(b) { + return false + } + for i, v := range a { + if b[i] != v { + return false + } + } + return true +} + +func (a *Mirror) GetSnaplen() *int { + return a.Snaplen +} + +func copyMirrorSnaplen(a *int) *int { + if a == nil { + return nil + } + b := *a + return &b +} + +func equalMirrorSnaplen(a, b *int) bool { + if (a == nil) != (b == nil) { + return false + } + if a == b { + return true + } + return *a == *b +} + +func (a *Mirror) GetStatistics() map[string]int { + return a.Statistics +} + +func copyMirrorStatistics(a map[string]int) map[string]int { + if a == nil { + return nil + } + b := make(map[string]int, len(a)) + for k, v := range a { + b[k] = v + } + return b +} + +func equalMirrorStatistics(a, b map[string]int) bool { + if (a == nil) != (b == nil) { + return false + } + if len(a) != len(b) { + return false + } + for k, v := range a { + if w, ok := b[k]; !ok || v != w { + return false + } + } + return true +} + +func (a *Mirror) DeepCopyInto(b *Mirror) { + *b = *a + b.ExternalIDs = copyMirrorExternalIDs(a.ExternalIDs) + b.OutputPort = copyMirrorOutputPort(a.OutputPort) + b.OutputVLAN = copyMirrorOutputVLAN(a.OutputVLAN) + b.SelectDstPort = copyMirrorSelectDstPort(a.SelectDstPort) + b.SelectSrcPort = copyMirrorSelectSrcPort(a.SelectSrcPort) + b.SelectVLAN = copyMirrorSelectVLAN(a.SelectVLAN) + b.Snaplen = copyMirrorSnaplen(a.Snaplen) + b.Statistics = copyMirrorStatistics(a.Statistics) +} + +func (a *Mirror) DeepCopy() *Mirror { + b := new(Mirror) + a.DeepCopyInto(b) + return b +} + +func (a *Mirror) CloneModelInto(b model.Model) { + c := b.(*Mirror) + a.DeepCopyInto(c) +} + +func (a *Mirror) CloneModel() model.Model { + return a.DeepCopy() +} + +func (a *Mirror) Equals(b *Mirror) bool { + return a.UUID == b.UUID && + equalMirrorExternalIDs(a.ExternalIDs, b.ExternalIDs) && + a.Name == b.Name && + equalMirrorOutputPort(a.OutputPort, b.OutputPort) && + equalMirrorOutputVLAN(a.OutputVLAN, b.OutputVLAN) && + a.SelectAll == b.SelectAll && + equalMirrorSelectDstPort(a.SelectDstPort, b.SelectDstPort) && + equalMirrorSelectSrcPort(a.SelectSrcPort, b.SelectSrcPort) && + equalMirrorSelectVLAN(a.SelectVLAN, b.SelectVLAN) && + equalMirrorSnaplen(a.Snaplen, b.Snaplen) && + equalMirrorStatistics(a.Statistics, b.Statistics) +} + +func (a *Mirror) EqualsModel(b model.Model) bool { + c := b.(*Mirror) + return a.Equals(c) +} + +var _ model.CloneableModel = &Mirror{} +var _ model.ComparableModel = &Mirror{} diff --git a/go-controller/pkg/vswitchd/model.go b/go-controller/pkg/vswitchd/model.go new file mode 100644 index 00000000000..c862f042779 --- /dev/null +++ b/go-controller/pkg/vswitchd/model.go @@ -0,0 +1,2012 @@ +// Code generated by "libovsdb.modelgen" +// DO NOT EDIT. + +package vswitchd + +import ( + "encoding/json" + + "github.com/ovn-org/libovsdb/model" + "github.com/ovn-org/libovsdb/ovsdb" +) + +// FullDatabaseModel returns the DatabaseModel object to be used in libovsdb +func FullDatabaseModel() (model.ClientDBModel, error) { + return model.NewClientDBModel("Open_vSwitch", map[string]model.Model{ + "AutoAttach": &AutoAttach{}, + "Bridge": &Bridge{}, + "CT_Timeout_Policy": &CTTimeoutPolicy{}, + "CT_Zone": &CTZone{}, + "Controller": &Controller{}, + "Datapath": &Datapath{}, + "Flow_Sample_Collector_Set": &FlowSampleCollectorSet{}, + "Flow_Table": &FlowTable{}, + "IPFIX": &IPFIX{}, + "Interface": &Interface{}, + "Manager": &Manager{}, + "Mirror": &Mirror{}, + "NetFlow": &NetFlow{}, + "Open_vSwitch": &OpenvSwitch{}, + "Port": &Port{}, + "QoS": &QoS{}, + "Queue": &Queue{}, + "SSL": &SSL{}, + "sFlow": &SFlow{}, + }) +} + +var schema = `{ + "name": "Open_vSwitch", + "version": "8.3.0", + "tables": { + "AutoAttach": { + "columns": { + "mappings": { + "type": { + "key": { + "type": "integer", + "minInteger": 0, + "maxInteger": 16777215 + }, + "value": { + "type": "integer", + "minInteger": 0, + "maxInteger": 4095 + }, + "min": 0, + "max": "unlimited" + } + }, + "system_description": { + "type": "string" + }, + "system_name": { + "type": "string" + } + } + }, + "Bridge": { + "columns": { + "auto_attach": { + "type": { + "key": { + "type": "uuid", + "refTable": "AutoAttach" + }, + "min": 0, + "max": 1 + } + }, + "controller": { + "type": { + "key": { + "type": "uuid", + "refTable": "Controller" + }, + "min": 0, + "max": "unlimited" + } + }, + "datapath_id": { + "type": { + "key": { + "type": "string" + }, + "min": 0, + "max": 1 + }, + "ephemeral": true + }, + "datapath_type": { + "type": "string" + }, + "datapath_version": { + "type": "string" + }, + "external_ids": { + "type": { + "key": { + "type": "string" + }, + "value": { + "type": "string" + }, + "min": 0, + "max": "unlimited" + } + }, + "fail_mode": { + "type": { + "key": { + "type": "string", + "enum": [ + "set", + [ + "standalone", + "secure" + ] + ] + }, + "min": 0, + "max": 1 + } + }, + "flood_vlans": { + "type": { + "key": { + "type": "integer", + "minInteger": 0, + "maxInteger": 4095 + }, + "min": 0, + "max": 4096 + } + }, + "flow_tables": { + "type": { + "key": { + "type": "integer", + "minInteger": 0, + "maxInteger": 254 + }, + "value": { + "type": "uuid", + "refTable": "Flow_Table" + }, + "min": 0, + "max": "unlimited" + } + }, + "ipfix": { + "type": { + "key": { + "type": "uuid", + "refTable": "IPFIX" + }, + "min": 0, + "max": 1 + } + }, + "mcast_snooping_enable": { + "type": "boolean" + }, + "mirrors": { + "type": { + "key": { + "type": "uuid", + "refTable": "Mirror" + }, + "min": 0, + "max": "unlimited" + } + }, + "name": { + "type": "string", + "mutable": false + }, + "netflow": { + "type": { + "key": { + "type": "uuid", + "refTable": "NetFlow" + }, + "min": 0, + "max": 1 + } + }, + "other_config": { + "type": { + "key": { + "type": "string" + }, + "value": { + "type": "string" + }, + "min": 0, + "max": "unlimited" + } + }, + "ports": { + "type": { + "key": { + "type": "uuid", + "refTable": "Port" + }, + "min": 0, + "max": "unlimited" + } + }, + "protocols": { + "type": { + "key": { + "type": "string", + "enum": [ + "set", + [ + "OpenFlow10", + "OpenFlow11", + "OpenFlow12", + "OpenFlow13", + "OpenFlow14", + "OpenFlow15" + ] + ] + }, + "min": 0, + "max": "unlimited" + } + }, + "rstp_enable": { + "type": "boolean" + }, + "rstp_status": { + "type": { + "key": { + "type": "string" + }, + "value": { + "type": "string" + }, + "min": 0, + "max": "unlimited" + }, + "ephemeral": true + }, + "sflow": { + "type": { + "key": { + "type": "uuid", + "refTable": "sFlow" + }, + "min": 0, + "max": 1 + } + }, + "status": { + "type": { + "key": { + "type": "string" + }, + "value": { + "type": "string" + }, + "min": 0, + "max": "unlimited" + }, + "ephemeral": true + }, + "stp_enable": { + "type": "boolean" + } + }, + "indexes": [ + [ + "name" + ] + ] + }, + "CT_Timeout_Policy": { + "columns": { + "external_ids": { + "type": { + "key": { + "type": "string" + }, + "value": { + "type": "string" + }, + "min": 0, + "max": "unlimited" + } + }, + "timeouts": { + "type": { + "key": { + "type": "string", + "enum": [ + "set", + [ + "tcp_syn_sent", + "tcp_syn_recv", + "tcp_established", + "tcp_fin_wait", + "tcp_close_wait", + "tcp_last_ack", + "tcp_time_wait", + "tcp_close", + "tcp_syn_sent2", + "tcp_retransmit", + "tcp_unack", + "udp_first", + "udp_single", + "udp_multiple", + "icmp_first", + "icmp_reply" + ] + ] + }, + "value": { + "type": "integer", + "minInteger": 0, + "maxInteger": 4294967295 + }, + "min": 0, + "max": "unlimited" + } + } + } + }, + "CT_Zone": { + "columns": { + "external_ids": { + "type": { + "key": { + "type": "string" + }, + "value": { + "type": "string" + }, + "min": 0, + "max": "unlimited" + } + }, + "timeout_policy": { + "type": { + "key": { + "type": "uuid", + "refTable": "CT_Timeout_Policy" + }, + "min": 0, + "max": 1 + } + } + } + }, + "Controller": { + "columns": { + "connection_mode": { + "type": { + "key": { + "type": "string", + "enum": [ + "set", + [ + "in-band", + "out-of-band" + ] + ] + }, + "min": 0, + "max": 1 + } + }, + "controller_burst_limit": { + "type": { + "key": { + "type": "integer", + "minInteger": 25 + }, + "min": 0, + "max": 1 + } + }, + "controller_queue_size": { + "type": { + "key": { + "type": "integer", + "minInteger": 1, + "maxInteger": 512 + }, + "min": 0, + "max": 1 + } + }, + "controller_rate_limit": { + "type": { + "key": { + "type": "integer", + "minInteger": 100 + }, + "min": 0, + "max": 1 + } + }, + "enable_async_messages": { + "type": { + "key": { + "type": "boolean" + }, + "min": 0, + "max": 1 + } + }, + "external_ids": { + "type": { + "key": { + "type": "string" + }, + "value": { + "type": "string" + }, + "min": 0, + "max": "unlimited" + } + }, + "inactivity_probe": { + "type": { + "key": { + "type": "integer" + }, + "min": 0, + "max": 1 + } + }, + "is_connected": { + "type": "boolean", + "ephemeral": true + }, + "local_gateway": { + "type": { + "key": { + "type": "string" + }, + "min": 0, + "max": 1 + } + }, + "local_ip": { + "type": { + "key": { + "type": "string" + }, + "min": 0, + "max": 1 + } + }, + "local_netmask": { + "type": { + "key": { + "type": "string" + }, + "min": 0, + "max": 1 + } + }, + "max_backoff": { + "type": { + "key": { + "type": "integer", + "minInteger": 1000 + }, + "min": 0, + "max": 1 + } + }, + "other_config": { + "type": { + "key": { + "type": "string" + }, + "value": { + "type": "string" + }, + "min": 0, + "max": "unlimited" + } + }, + "role": { + "type": { + "key": { + "type": "string", + "enum": [ + "set", + [ + "other", + "master", + "slave" + ] + ] + }, + "min": 0, + "max": 1 + }, + "ephemeral": true + }, + "status": { + "type": { + "key": { + "type": "string" + }, + "value": { + "type": "string" + }, + "min": 0, + "max": "unlimited" + }, + "ephemeral": true + }, + "target": { + "type": "string" + }, + "type": { + "type": { + "key": { + "type": "string", + "enum": [ + "set", + [ + "primary", + "service" + ] + ] + }, + "min": 0, + "max": 1 + } + } + } + }, + "Datapath": { + "columns": { + "capabilities": { + "type": { + "key": { + "type": "string" + }, + "value": { + "type": "string" + }, + "min": 0, + "max": "unlimited" + } + }, + "ct_zones": { + "type": { + "key": { + "type": "integer", + "minInteger": 0, + "maxInteger": 65535 + }, + "value": { + "type": "uuid", + "refTable": "CT_Zone" + }, + "min": 0, + "max": "unlimited" + } + }, + "datapath_version": { + "type": "string" + }, + "external_ids": { + "type": { + "key": { + "type": "string" + }, + "value": { + "type": "string" + }, + "min": 0, + "max": "unlimited" + } + } + } + }, + "Flow_Sample_Collector_Set": { + "columns": { + "bridge": { + "type": { + "key": { + "type": "uuid", + "refTable": "Bridge" + }, + "min": 1, + "max": 1 + } + }, + "external_ids": { + "type": { + "key": { + "type": "string" + }, + "value": { + "type": "string" + }, + "min": 0, + "max": "unlimited" + } + }, + "id": { + "type": { + "key": { + "type": "integer", + "minInteger": 0, + "maxInteger": 4294967295 + }, + "min": 1, + "max": 1 + } + }, + "ipfix": { + "type": { + "key": { + "type": "uuid", + "refTable": "IPFIX" + }, + "min": 0, + "max": 1 + } + } + }, + "indexes": [ + [ + "id", + "bridge" + ] + ], + "isRoot": true + }, + "Flow_Table": { + "columns": { + "external_ids": { + "type": { + "key": { + "type": "string" + }, + "value": { + "type": "string" + }, + "min": 0, + "max": "unlimited" + } + }, + "flow_limit": { + "type": { + "key": { + "type": "integer", + "minInteger": 0 + }, + "min": 0, + "max": 1 + } + }, + "groups": { + "type": { + "key": { + "type": "string" + }, + "min": 0, + "max": "unlimited" + } + }, + "name": { + "type": { + "key": { + "type": "string" + }, + "min": 0, + "max": 1 + } + }, + "overflow_policy": { + "type": { + "key": { + "type": "string", + "enum": [ + "set", + [ + "refuse", + "evict" + ] + ] + }, + "min": 0, + "max": 1 + } + }, + "prefixes": { + "type": { + "key": { + "type": "string" + }, + "min": 0, + "max": 3 + } + } + } + }, + "IPFIX": { + "columns": { + "cache_active_timeout": { + "type": { + "key": { + "type": "integer", + "minInteger": 0, + "maxInteger": 4200 + }, + "min": 0, + "max": 1 + } + }, + "cache_max_flows": { + "type": { + "key": { + "type": "integer", + "minInteger": 0, + "maxInteger": 4294967295 + }, + "min": 0, + "max": 1 + } + }, + "external_ids": { + "type": { + "key": { + "type": "string" + }, + "value": { + "type": "string" + }, + "min": 0, + "max": "unlimited" + } + }, + "obs_domain_id": { + "type": { + "key": { + "type": "integer", + "minInteger": 0, + "maxInteger": 4294967295 + }, + "min": 0, + "max": 1 + } + }, + "obs_point_id": { + "type": { + "key": { + "type": "integer", + "minInteger": 0, + "maxInteger": 4294967295 + }, + "min": 0, + "max": 1 + } + }, + "other_config": { + "type": { + "key": { + "type": "string" + }, + "value": { + "type": "string" + }, + "min": 0, + "max": "unlimited" + } + }, + "sampling": { + "type": { + "key": { + "type": "integer", + "minInteger": 1, + "maxInteger": 4294967295 + }, + "min": 0, + "max": 1 + } + }, + "targets": { + "type": { + "key": { + "type": "string" + }, + "min": 0, + "max": "unlimited" + } + } + } + }, + "Interface": { + "columns": { + "admin_state": { + "type": { + "key": { + "type": "string", + "enum": [ + "set", + [ + "up", + "down" + ] + ] + }, + "min": 0, + "max": 1 + }, + "ephemeral": true + }, + "bfd": { + "type": { + "key": { + "type": "string" + }, + "value": { + "type": "string" + }, + "min": 0, + "max": "unlimited" + } + }, + "bfd_status": { + "type": { + "key": { + "type": "string" + }, + "value": { + "type": "string" + }, + "min": 0, + "max": "unlimited" + } + }, + "cfm_fault": { + "type": { + "key": { + "type": "boolean" + }, + "min": 0, + "max": 1 + }, + "ephemeral": true + }, + "cfm_fault_status": { + "type": { + "key": { + "type": "string" + }, + "min": 0, + "max": "unlimited" + }, + "ephemeral": true + }, + "cfm_flap_count": { + "type": { + "key": { + "type": "integer" + }, + "min": 0, + "max": 1 + } + }, + "cfm_health": { + "type": { + "key": { + "type": "integer", + "minInteger": 0, + "maxInteger": 100 + }, + "min": 0, + "max": 1 + }, + "ephemeral": true + }, + "cfm_mpid": { + "type": { + "key": { + "type": "integer" + }, + "min": 0, + "max": 1 + } + }, + "cfm_remote_mpids": { + "type": { + "key": { + "type": "integer" + }, + "min": 0, + "max": "unlimited" + }, + "ephemeral": true + }, + "cfm_remote_opstate": { + "type": { + "key": { + "type": "string", + "enum": [ + "set", + [ + "up", + "down" + ] + ] + }, + "min": 0, + "max": 1 + }, + "ephemeral": true + }, + "duplex": { + "type": { + "key": { + "type": "string", + "enum": [ + "set", + [ + "half", + "full" + ] + ] + }, + "min": 0, + "max": 1 + }, + "ephemeral": true + }, + "error": { + "type": { + "key": { + "type": "string" + }, + "min": 0, + "max": 1 + } + }, + "external_ids": { + "type": { + "key": { + "type": "string" + }, + "value": { + "type": "string" + }, + "min": 0, + "max": "unlimited" + } + }, + "ifindex": { + "type": { + "key": { + "type": "integer", + "minInteger": 0, + "maxInteger": 4294967295 + }, + "min": 0, + "max": 1 + }, + "ephemeral": true + }, + "ingress_policing_burst": { + "type": { + "key": { + "type": "integer", + "minInteger": 0 + } + } + }, + "ingress_policing_kpkts_burst": { + "type": { + "key": { + "type": "integer", + "minInteger": 0 + } + } + }, + "ingress_policing_kpkts_rate": { + "type": { + "key": { + "type": "integer", + "minInteger": 0 + } + } + }, + "ingress_policing_rate": { + "type": { + "key": { + "type": "integer", + "minInteger": 0 + } + } + }, + "lacp_current": { + "type": { + "key": { + "type": "boolean" + }, + "min": 0, + "max": 1 + }, + "ephemeral": true + }, + "link_resets": { + "type": { + "key": { + "type": "integer" + }, + "min": 0, + "max": 1 + }, + "ephemeral": true + }, + "link_speed": { + "type": { + "key": { + "type": "integer" + }, + "min": 0, + "max": 1 + }, + "ephemeral": true + }, + "link_state": { + "type": { + "key": { + "type": "string", + "enum": [ + "set", + [ + "up", + "down" + ] + ] + }, + "min": 0, + "max": 1 + }, + "ephemeral": true + }, + "lldp": { + "type": { + "key": { + "type": "string" + }, + "value": { + "type": "string" + }, + "min": 0, + "max": "unlimited" + } + }, + "mac": { + "type": { + "key": { + "type": "string" + }, + "min": 0, + "max": 1 + } + }, + "mac_in_use": { + "type": { + "key": { + "type": "string" + }, + "min": 0, + "max": 1 + }, + "ephemeral": true + }, + "mtu": { + "type": { + "key": { + "type": "integer" + }, + "min": 0, + "max": 1 + }, + "ephemeral": true + }, + "mtu_request": { + "type": { + "key": { + "type": "integer", + "minInteger": 1 + }, + "min": 0, + "max": 1 + } + }, + "name": { + "type": "string", + "mutable": false + }, + "ofport": { + "type": { + "key": { + "type": "integer" + }, + "min": 0, + "max": 1 + } + }, + "ofport_request": { + "type": { + "key": { + "type": "integer", + "minInteger": 1, + "maxInteger": 65279 + }, + "min": 0, + "max": 1 + } + }, + "options": { + "type": { + "key": { + "type": "string" + }, + "value": { + "type": "string" + }, + "min": 0, + "max": "unlimited" + } + }, + "other_config": { + "type": { + "key": { + "type": "string" + }, + "value": { + "type": "string" + }, + "min": 0, + "max": "unlimited" + } + }, + "statistics": { + "type": { + "key": { + "type": "string" + }, + "value": { + "type": "integer" + }, + "min": 0, + "max": "unlimited" + }, + "ephemeral": true + }, + "status": { + "type": { + "key": { + "type": "string" + }, + "value": { + "type": "string" + }, + "min": 0, + "max": "unlimited" + }, + "ephemeral": true + }, + "type": { + "type": "string" + } + }, + "indexes": [ + [ + "name" + ] + ] + }, + "Manager": { + "columns": { + "connection_mode": { + "type": { + "key": { + "type": "string", + "enum": [ + "set", + [ + "in-band", + "out-of-band" + ] + ] + }, + "min": 0, + "max": 1 + } + }, + "external_ids": { + "type": { + "key": { + "type": "string" + }, + "value": { + "type": "string" + }, + "min": 0, + "max": "unlimited" + } + }, + "inactivity_probe": { + "type": { + "key": { + "type": "integer" + }, + "min": 0, + "max": 1 + } + }, + "is_connected": { + "type": "boolean", + "ephemeral": true + }, + "max_backoff": { + "type": { + "key": { + "type": "integer", + "minInteger": 1000 + }, + "min": 0, + "max": 1 + } + }, + "other_config": { + "type": { + "key": { + "type": "string" + }, + "value": { + "type": "string" + }, + "min": 0, + "max": "unlimited" + } + }, + "status": { + "type": { + "key": { + "type": "string" + }, + "value": { + "type": "string" + }, + "min": 0, + "max": "unlimited" + }, + "ephemeral": true + }, + "target": { + "type": "string" + } + }, + "indexes": [ + [ + "target" + ] + ] + }, + "Mirror": { + "columns": { + "external_ids": { + "type": { + "key": { + "type": "string" + }, + "value": { + "type": "string" + }, + "min": 0, + "max": "unlimited" + } + }, + "name": { + "type": "string" + }, + "output_port": { + "type": { + "key": { + "type": "uuid", + "refTable": "Port", + "refType": "weak" + }, + "min": 0, + "max": 1 + } + }, + "output_vlan": { + "type": { + "key": { + "type": "integer", + "minInteger": 1, + "maxInteger": 4095 + }, + "min": 0, + "max": 1 + } + }, + "select_all": { + "type": "boolean" + }, + "select_dst_port": { + "type": { + "key": { + "type": "uuid", + "refTable": "Port", + "refType": "weak" + }, + "min": 0, + "max": "unlimited" + } + }, + "select_src_port": { + "type": { + "key": { + "type": "uuid", + "refTable": "Port", + "refType": "weak" + }, + "min": 0, + "max": "unlimited" + } + }, + "select_vlan": { + "type": { + "key": { + "type": "integer", + "minInteger": 0, + "maxInteger": 4095 + }, + "min": 0, + "max": 4096 + } + }, + "snaplen": { + "type": { + "key": { + "type": "integer", + "minInteger": 14, + "maxInteger": 65535 + }, + "min": 0, + "max": 1 + } + }, + "statistics": { + "type": { + "key": { + "type": "string" + }, + "value": { + "type": "integer" + }, + "min": 0, + "max": "unlimited" + }, + "ephemeral": true + } + } + }, + "NetFlow": { + "columns": { + "active_timeout": { + "type": { + "key": { + "type": "integer", + "minInteger": -1 + } + } + }, + "add_id_to_interface": { + "type": "boolean" + }, + "engine_id": { + "type": { + "key": { + "type": "integer", + "minInteger": 0, + "maxInteger": 255 + }, + "min": 0, + "max": 1 + } + }, + "engine_type": { + "type": { + "key": { + "type": "integer", + "minInteger": 0, + "maxInteger": 255 + }, + "min": 0, + "max": 1 + } + }, + "external_ids": { + "type": { + "key": { + "type": "string" + }, + "value": { + "type": "string" + }, + "min": 0, + "max": "unlimited" + } + }, + "targets": { + "type": { + "key": { + "type": "string" + }, + "min": 1, + "max": "unlimited" + } + } + } + }, + "Open_vSwitch": { + "columns": { + "bridges": { + "type": { + "key": { + "type": "uuid", + "refTable": "Bridge" + }, + "min": 0, + "max": "unlimited" + } + }, + "cur_cfg": { + "type": "integer" + }, + "datapath_types": { + "type": { + "key": { + "type": "string" + }, + "min": 0, + "max": "unlimited" + } + }, + "datapaths": { + "type": { + "key": { + "type": "string" + }, + "value": { + "type": "uuid", + "refTable": "Datapath" + }, + "min": 0, + "max": "unlimited" + } + }, + "db_version": { + "type": { + "key": { + "type": "string" + }, + "min": 0, + "max": 1 + } + }, + "dpdk_initialized": { + "type": "boolean" + }, + "dpdk_version": { + "type": { + "key": { + "type": "string" + }, + "min": 0, + "max": 1 + } + }, + "external_ids": { + "type": { + "key": { + "type": "string" + }, + "value": { + "type": "string" + }, + "min": 0, + "max": "unlimited" + } + }, + "iface_types": { + "type": { + "key": { + "type": "string" + }, + "min": 0, + "max": "unlimited" + } + }, + "manager_options": { + "type": { + "key": { + "type": "uuid", + "refTable": "Manager" + }, + "min": 0, + "max": "unlimited" + } + }, + "next_cfg": { + "type": "integer" + }, + "other_config": { + "type": { + "key": { + "type": "string" + }, + "value": { + "type": "string" + }, + "min": 0, + "max": "unlimited" + } + }, + "ovs_version": { + "type": { + "key": { + "type": "string" + }, + "min": 0, + "max": 1 + } + }, + "ssl": { + "type": { + "key": { + "type": "uuid", + "refTable": "SSL" + }, + "min": 0, + "max": 1 + } + }, + "statistics": { + "type": { + "key": { + "type": "string" + }, + "value": { + "type": "string" + }, + "min": 0, + "max": "unlimited" + }, + "ephemeral": true + }, + "system_type": { + "type": { + "key": { + "type": "string" + }, + "min": 0, + "max": 1 + } + }, + "system_version": { + "type": { + "key": { + "type": "string" + }, + "min": 0, + "max": 1 + } + } + }, + "isRoot": true + }, + "Port": { + "columns": { + "bond_active_slave": { + "type": { + "key": { + "type": "string" + }, + "min": 0, + "max": 1 + } + }, + "bond_downdelay": { + "type": "integer" + }, + "bond_fake_iface": { + "type": "boolean" + }, + "bond_mode": { + "type": { + "key": { + "type": "string", + "enum": [ + "set", + [ + "balance-tcp", + "balance-slb", + "active-backup" + ] + ] + }, + "min": 0, + "max": 1 + } + }, + "bond_updelay": { + "type": "integer" + }, + "cvlans": { + "type": { + "key": { + "type": "integer", + "minInteger": 0, + "maxInteger": 4095 + }, + "min": 0, + "max": 4096 + } + }, + "external_ids": { + "type": { + "key": { + "type": "string" + }, + "value": { + "type": "string" + }, + "min": 0, + "max": "unlimited" + } + }, + "fake_bridge": { + "type": "boolean" + }, + "interfaces": { + "type": { + "key": { + "type": "uuid", + "refTable": "Interface" + }, + "min": 1, + "max": "unlimited" + } + }, + "lacp": { + "type": { + "key": { + "type": "string", + "enum": [ + "set", + [ + "active", + "passive", + "off" + ] + ] + }, + "min": 0, + "max": 1 + } + }, + "mac": { + "type": { + "key": { + "type": "string" + }, + "min": 0, + "max": 1 + } + }, + "name": { + "type": "string", + "mutable": false + }, + "other_config": { + "type": { + "key": { + "type": "string" + }, + "value": { + "type": "string" + }, + "min": 0, + "max": "unlimited" + } + }, + "protected": { + "type": "boolean" + }, + "qos": { + "type": { + "key": { + "type": "uuid", + "refTable": "QoS" + }, + "min": 0, + "max": 1 + } + }, + "rstp_statistics": { + "type": { + "key": { + "type": "string" + }, + "value": { + "type": "integer" + }, + "min": 0, + "max": "unlimited" + }, + "ephemeral": true + }, + "rstp_status": { + "type": { + "key": { + "type": "string" + }, + "value": { + "type": "string" + }, + "min": 0, + "max": "unlimited" + }, + "ephemeral": true + }, + "statistics": { + "type": { + "key": { + "type": "string" + }, + "value": { + "type": "integer" + }, + "min": 0, + "max": "unlimited" + }, + "ephemeral": true + }, + "status": { + "type": { + "key": { + "type": "string" + }, + "value": { + "type": "string" + }, + "min": 0, + "max": "unlimited" + }, + "ephemeral": true + }, + "tag": { + "type": { + "key": { + "type": "integer", + "minInteger": 0, + "maxInteger": 4095 + }, + "min": 0, + "max": 1 + } + }, + "trunks": { + "type": { + "key": { + "type": "integer", + "minInteger": 0, + "maxInteger": 4095 + }, + "min": 0, + "max": 4096 + } + }, + "vlan_mode": { + "type": { + "key": { + "type": "string", + "enum": [ + "set", + [ + "trunk", + "access", + "native-tagged", + "native-untagged", + "dot1q-tunnel" + ] + ] + }, + "min": 0, + "max": 1 + } + } + }, + "indexes": [ + [ + "name" + ] + ] + }, + "QoS": { + "columns": { + "external_ids": { + "type": { + "key": { + "type": "string" + }, + "value": { + "type": "string" + }, + "min": 0, + "max": "unlimited" + } + }, + "other_config": { + "type": { + "key": { + "type": "string" + }, + "value": { + "type": "string" + }, + "min": 0, + "max": "unlimited" + } + }, + "queues": { + "type": { + "key": { + "type": "integer", + "minInteger": 0, + "maxInteger": 4294967295 + }, + "value": { + "type": "uuid", + "refTable": "Queue" + }, + "min": 0, + "max": "unlimited" + } + }, + "type": { + "type": "string" + } + }, + "isRoot": true + }, + "Queue": { + "columns": { + "dscp": { + "type": { + "key": { + "type": "integer", + "minInteger": 0, + "maxInteger": 63 + }, + "min": 0, + "max": 1 + } + }, + "external_ids": { + "type": { + "key": { + "type": "string" + }, + "value": { + "type": "string" + }, + "min": 0, + "max": "unlimited" + } + }, + "other_config": { + "type": { + "key": { + "type": "string" + }, + "value": { + "type": "string" + }, + "min": 0, + "max": "unlimited" + } + } + }, + "isRoot": true + }, + "SSL": { + "columns": { + "bootstrap_ca_cert": { + "type": "boolean" + }, + "ca_cert": { + "type": "string" + }, + "certificate": { + "type": "string" + }, + "external_ids": { + "type": { + "key": { + "type": "string" + }, + "value": { + "type": "string" + }, + "min": 0, + "max": "unlimited" + } + }, + "private_key": { + "type": "string" + } + } + }, + "sFlow": { + "columns": { + "agent": { + "type": { + "key": { + "type": "string" + }, + "min": 0, + "max": 1 + } + }, + "external_ids": { + "type": { + "key": { + "type": "string" + }, + "value": { + "type": "string" + }, + "min": 0, + "max": "unlimited" + } + }, + "header": { + "type": { + "key": { + "type": "integer" + }, + "min": 0, + "max": 1 + } + }, + "polling": { + "type": { + "key": { + "type": "integer" + }, + "min": 0, + "max": 1 + } + }, + "sampling": { + "type": { + "key": { + "type": "integer" + }, + "min": 0, + "max": 1 + } + }, + "targets": { + "type": { + "key": { + "type": "string" + }, + "min": 1, + "max": "unlimited" + } + } + } + } + } +}` + +func Schema() ovsdb.DatabaseSchema { + var s ovsdb.DatabaseSchema + err := json.Unmarshal([]byte(schema), &s) + if err != nil { + panic(err) + } + return s +} diff --git a/go-controller/pkg/vswitchd/netflow.go b/go-controller/pkg/vswitchd/netflow.go new file mode 100644 index 00000000000..f9585870447 --- /dev/null +++ b/go-controller/pkg/vswitchd/netflow.go @@ -0,0 +1,174 @@ +// Code generated by "libovsdb.modelgen" +// DO NOT EDIT. + +package vswitchd + +import "github.com/ovn-org/libovsdb/model" + +const NetFlowTable = "NetFlow" + +// NetFlow defines an object in NetFlow table +type NetFlow struct { + UUID string `ovsdb:"_uuid"` + ActiveTimeout int `ovsdb:"active_timeout"` + AddIDToInterface bool `ovsdb:"add_id_to_interface"` + EngineID *int `ovsdb:"engine_id"` + EngineType *int `ovsdb:"engine_type"` + ExternalIDs map[string]string `ovsdb:"external_ids"` + Targets []string `ovsdb:"targets"` +} + +func (a *NetFlow) GetUUID() string { + return a.UUID +} + +func (a *NetFlow) GetActiveTimeout() int { + return a.ActiveTimeout +} + +func (a *NetFlow) GetAddIDToInterface() bool { + return a.AddIDToInterface +} + +func (a *NetFlow) GetEngineID() *int { + return a.EngineID +} + +func copyNetFlowEngineID(a *int) *int { + if a == nil { + return nil + } + b := *a + return &b +} + +func equalNetFlowEngineID(a, b *int) bool { + if (a == nil) != (b == nil) { + return false + } + if a == b { + return true + } + return *a == *b +} + +func (a *NetFlow) GetEngineType() *int { + return a.EngineType +} + +func copyNetFlowEngineType(a *int) *int { + if a == nil { + return nil + } + b := *a + return &b +} + +func equalNetFlowEngineType(a, b *int) bool { + if (a == nil) != (b == nil) { + return false + } + if a == b { + return true + } + return *a == *b +} + +func (a *NetFlow) GetExternalIDs() map[string]string { + return a.ExternalIDs +} + +func copyNetFlowExternalIDs(a map[string]string) map[string]string { + if a == nil { + return nil + } + b := make(map[string]string, len(a)) + for k, v := range a { + b[k] = v + } + return b +} + +func equalNetFlowExternalIDs(a, b map[string]string) bool { + if (a == nil) != (b == nil) { + return false + } + if len(a) != len(b) { + return false + } + for k, v := range a { + if w, ok := b[k]; !ok || v != w { + return false + } + } + return true +} + +func (a *NetFlow) GetTargets() []string { + return a.Targets +} + +func copyNetFlowTargets(a []string) []string { + if a == nil { + return nil + } + b := make([]string, len(a)) + copy(b, a) + return b +} + +func equalNetFlowTargets(a, b []string) bool { + if (a == nil) != (b == nil) { + return false + } + if len(a) != len(b) { + return false + } + for i, v := range a { + if b[i] != v { + return false + } + } + return true +} + +func (a *NetFlow) DeepCopyInto(b *NetFlow) { + *b = *a + b.EngineID = copyNetFlowEngineID(a.EngineID) + b.EngineType = copyNetFlowEngineType(a.EngineType) + b.ExternalIDs = copyNetFlowExternalIDs(a.ExternalIDs) + b.Targets = copyNetFlowTargets(a.Targets) +} + +func (a *NetFlow) DeepCopy() *NetFlow { + b := new(NetFlow) + a.DeepCopyInto(b) + return b +} + +func (a *NetFlow) CloneModelInto(b model.Model) { + c := b.(*NetFlow) + a.DeepCopyInto(c) +} + +func (a *NetFlow) CloneModel() model.Model { + return a.DeepCopy() +} + +func (a *NetFlow) Equals(b *NetFlow) bool { + return a.UUID == b.UUID && + a.ActiveTimeout == b.ActiveTimeout && + a.AddIDToInterface == b.AddIDToInterface && + equalNetFlowEngineID(a.EngineID, b.EngineID) && + equalNetFlowEngineType(a.EngineType, b.EngineType) && + equalNetFlowExternalIDs(a.ExternalIDs, b.ExternalIDs) && + equalNetFlowTargets(a.Targets, b.Targets) +} + +func (a *NetFlow) EqualsModel(b model.Model) bool { + c := b.(*NetFlow) + return a.Equals(c) +} + +var _ model.CloneableModel = &NetFlow{} +var _ model.ComparableModel = &NetFlow{} diff --git a/go-controller/pkg/vswitchd/open_vswitch.go b/go-controller/pkg/vswitchd/open_vswitch.go new file mode 100644 index 00000000000..e8ea481d5b4 --- /dev/null +++ b/go-controller/pkg/vswitchd/open_vswitch.go @@ -0,0 +1,472 @@ +// Code generated by "libovsdb.modelgen" +// DO NOT EDIT. + +package vswitchd + +import "github.com/ovn-org/libovsdb/model" + +const OpenvSwitchTable = "Open_vSwitch" + +// OpenvSwitch defines an object in Open_vSwitch table +type OpenvSwitch struct { + UUID string `ovsdb:"_uuid"` + Bridges []string `ovsdb:"bridges"` + CurCfg int `ovsdb:"cur_cfg"` + DatapathTypes []string `ovsdb:"datapath_types"` + Datapaths map[string]string `ovsdb:"datapaths"` + DbVersion *string `ovsdb:"db_version"` + DpdkInitialized bool `ovsdb:"dpdk_initialized"` + DpdkVersion *string `ovsdb:"dpdk_version"` + ExternalIDs map[string]string `ovsdb:"external_ids"` + IfaceTypes []string `ovsdb:"iface_types"` + ManagerOptions []string `ovsdb:"manager_options"` + NextCfg int `ovsdb:"next_cfg"` + OtherConfig map[string]string `ovsdb:"other_config"` + OVSVersion *string `ovsdb:"ovs_version"` + SSL *string `ovsdb:"ssl"` + Statistics map[string]string `ovsdb:"statistics"` + SystemType *string `ovsdb:"system_type"` + SystemVersion *string `ovsdb:"system_version"` +} + +func (a *OpenvSwitch) GetUUID() string { + return a.UUID +} + +func (a *OpenvSwitch) GetBridges() []string { + return a.Bridges +} + +func copyOpenvSwitchBridges(a []string) []string { + if a == nil { + return nil + } + b := make([]string, len(a)) + copy(b, a) + return b +} + +func equalOpenvSwitchBridges(a, b []string) bool { + if (a == nil) != (b == nil) { + return false + } + if len(a) != len(b) { + return false + } + for i, v := range a { + if b[i] != v { + return false + } + } + return true +} + +func (a *OpenvSwitch) GetCurCfg() int { + return a.CurCfg +} + +func (a *OpenvSwitch) GetDatapathTypes() []string { + return a.DatapathTypes +} + +func copyOpenvSwitchDatapathTypes(a []string) []string { + if a == nil { + return nil + } + b := make([]string, len(a)) + copy(b, a) + return b +} + +func equalOpenvSwitchDatapathTypes(a, b []string) bool { + if (a == nil) != (b == nil) { + return false + } + if len(a) != len(b) { + return false + } + for i, v := range a { + if b[i] != v { + return false + } + } + return true +} + +func (a *OpenvSwitch) GetDatapaths() map[string]string { + return a.Datapaths +} + +func copyOpenvSwitchDatapaths(a map[string]string) map[string]string { + if a == nil { + return nil + } + b := make(map[string]string, len(a)) + for k, v := range a { + b[k] = v + } + return b +} + +func equalOpenvSwitchDatapaths(a, b map[string]string) bool { + if (a == nil) != (b == nil) { + return false + } + if len(a) != len(b) { + return false + } + for k, v := range a { + if w, ok := b[k]; !ok || v != w { + return false + } + } + return true +} + +func (a *OpenvSwitch) GetDbVersion() *string { + return a.DbVersion +} + +func copyOpenvSwitchDbVersion(a *string) *string { + if a == nil { + return nil + } + b := *a + return &b +} + +func equalOpenvSwitchDbVersion(a, b *string) bool { + if (a == nil) != (b == nil) { + return false + } + if a == b { + return true + } + return *a == *b +} + +func (a *OpenvSwitch) GetDpdkInitialized() bool { + return a.DpdkInitialized +} + +func (a *OpenvSwitch) GetDpdkVersion() *string { + return a.DpdkVersion +} + +func copyOpenvSwitchDpdkVersion(a *string) *string { + if a == nil { + return nil + } + b := *a + return &b +} + +func equalOpenvSwitchDpdkVersion(a, b *string) bool { + if (a == nil) != (b == nil) { + return false + } + if a == b { + return true + } + return *a == *b +} + +func (a *OpenvSwitch) GetExternalIDs() map[string]string { + return a.ExternalIDs +} + +func copyOpenvSwitchExternalIDs(a map[string]string) map[string]string { + if a == nil { + return nil + } + b := make(map[string]string, len(a)) + for k, v := range a { + b[k] = v + } + return b +} + +func equalOpenvSwitchExternalIDs(a, b map[string]string) bool { + if (a == nil) != (b == nil) { + return false + } + if len(a) != len(b) { + return false + } + for k, v := range a { + if w, ok := b[k]; !ok || v != w { + return false + } + } + return true +} + +func (a *OpenvSwitch) GetIfaceTypes() []string { + return a.IfaceTypes +} + +func copyOpenvSwitchIfaceTypes(a []string) []string { + if a == nil { + return nil + } + b := make([]string, len(a)) + copy(b, a) + return b +} + +func equalOpenvSwitchIfaceTypes(a, b []string) bool { + if (a == nil) != (b == nil) { + return false + } + if len(a) != len(b) { + return false + } + for i, v := range a { + if b[i] != v { + return false + } + } + return true +} + +func (a *OpenvSwitch) GetManagerOptions() []string { + return a.ManagerOptions +} + +func copyOpenvSwitchManagerOptions(a []string) []string { + if a == nil { + return nil + } + b := make([]string, len(a)) + copy(b, a) + return b +} + +func equalOpenvSwitchManagerOptions(a, b []string) bool { + if (a == nil) != (b == nil) { + return false + } + if len(a) != len(b) { + return false + } + for i, v := range a { + if b[i] != v { + return false + } + } + return true +} + +func (a *OpenvSwitch) GetNextCfg() int { + return a.NextCfg +} + +func (a *OpenvSwitch) GetOtherConfig() map[string]string { + return a.OtherConfig +} + +func copyOpenvSwitchOtherConfig(a map[string]string) map[string]string { + if a == nil { + return nil + } + b := make(map[string]string, len(a)) + for k, v := range a { + b[k] = v + } + return b +} + +func equalOpenvSwitchOtherConfig(a, b map[string]string) bool { + if (a == nil) != (b == nil) { + return false + } + if len(a) != len(b) { + return false + } + for k, v := range a { + if w, ok := b[k]; !ok || v != w { + return false + } + } + return true +} + +func (a *OpenvSwitch) GetOVSVersion() *string { + return a.OVSVersion +} + +func copyOpenvSwitchOVSVersion(a *string) *string { + if a == nil { + return nil + } + b := *a + return &b +} + +func equalOpenvSwitchOVSVersion(a, b *string) bool { + if (a == nil) != (b == nil) { + return false + } + if a == b { + return true + } + return *a == *b +} + +func (a *OpenvSwitch) GetSSL() *string { + return a.SSL +} + +func copyOpenvSwitchSSL(a *string) *string { + if a == nil { + return nil + } + b := *a + return &b +} + +func equalOpenvSwitchSSL(a, b *string) bool { + if (a == nil) != (b == nil) { + return false + } + if a == b { + return true + } + return *a == *b +} + +func (a *OpenvSwitch) GetStatistics() map[string]string { + return a.Statistics +} + +func copyOpenvSwitchStatistics(a map[string]string) map[string]string { + if a == nil { + return nil + } + b := make(map[string]string, len(a)) + for k, v := range a { + b[k] = v + } + return b +} + +func equalOpenvSwitchStatistics(a, b map[string]string) bool { + if (a == nil) != (b == nil) { + return false + } + if len(a) != len(b) { + return false + } + for k, v := range a { + if w, ok := b[k]; !ok || v != w { + return false + } + } + return true +} + +func (a *OpenvSwitch) GetSystemType() *string { + return a.SystemType +} + +func copyOpenvSwitchSystemType(a *string) *string { + if a == nil { + return nil + } + b := *a + return &b +} + +func equalOpenvSwitchSystemType(a, b *string) bool { + if (a == nil) != (b == nil) { + return false + } + if a == b { + return true + } + return *a == *b +} + +func (a *OpenvSwitch) GetSystemVersion() *string { + return a.SystemVersion +} + +func copyOpenvSwitchSystemVersion(a *string) *string { + if a == nil { + return nil + } + b := *a + return &b +} + +func equalOpenvSwitchSystemVersion(a, b *string) bool { + if (a == nil) != (b == nil) { + return false + } + if a == b { + return true + } + return *a == *b +} + +func (a *OpenvSwitch) DeepCopyInto(b *OpenvSwitch) { + *b = *a + b.Bridges = copyOpenvSwitchBridges(a.Bridges) + b.DatapathTypes = copyOpenvSwitchDatapathTypes(a.DatapathTypes) + b.Datapaths = copyOpenvSwitchDatapaths(a.Datapaths) + b.DbVersion = copyOpenvSwitchDbVersion(a.DbVersion) + b.DpdkVersion = copyOpenvSwitchDpdkVersion(a.DpdkVersion) + b.ExternalIDs = copyOpenvSwitchExternalIDs(a.ExternalIDs) + b.IfaceTypes = copyOpenvSwitchIfaceTypes(a.IfaceTypes) + b.ManagerOptions = copyOpenvSwitchManagerOptions(a.ManagerOptions) + b.OtherConfig = copyOpenvSwitchOtherConfig(a.OtherConfig) + b.OVSVersion = copyOpenvSwitchOVSVersion(a.OVSVersion) + b.SSL = copyOpenvSwitchSSL(a.SSL) + b.Statistics = copyOpenvSwitchStatistics(a.Statistics) + b.SystemType = copyOpenvSwitchSystemType(a.SystemType) + b.SystemVersion = copyOpenvSwitchSystemVersion(a.SystemVersion) +} + +func (a *OpenvSwitch) DeepCopy() *OpenvSwitch { + b := new(OpenvSwitch) + a.DeepCopyInto(b) + return b +} + +func (a *OpenvSwitch) CloneModelInto(b model.Model) { + c := b.(*OpenvSwitch) + a.DeepCopyInto(c) +} + +func (a *OpenvSwitch) CloneModel() model.Model { + return a.DeepCopy() +} + +func (a *OpenvSwitch) Equals(b *OpenvSwitch) bool { + return a.UUID == b.UUID && + equalOpenvSwitchBridges(a.Bridges, b.Bridges) && + a.CurCfg == b.CurCfg && + equalOpenvSwitchDatapathTypes(a.DatapathTypes, b.DatapathTypes) && + equalOpenvSwitchDatapaths(a.Datapaths, b.Datapaths) && + equalOpenvSwitchDbVersion(a.DbVersion, b.DbVersion) && + a.DpdkInitialized == b.DpdkInitialized && + equalOpenvSwitchDpdkVersion(a.DpdkVersion, b.DpdkVersion) && + equalOpenvSwitchExternalIDs(a.ExternalIDs, b.ExternalIDs) && + equalOpenvSwitchIfaceTypes(a.IfaceTypes, b.IfaceTypes) && + equalOpenvSwitchManagerOptions(a.ManagerOptions, b.ManagerOptions) && + a.NextCfg == b.NextCfg && + equalOpenvSwitchOtherConfig(a.OtherConfig, b.OtherConfig) && + equalOpenvSwitchOVSVersion(a.OVSVersion, b.OVSVersion) && + equalOpenvSwitchSSL(a.SSL, b.SSL) && + equalOpenvSwitchStatistics(a.Statistics, b.Statistics) && + equalOpenvSwitchSystemType(a.SystemType, b.SystemType) && + equalOpenvSwitchSystemVersion(a.SystemVersion, b.SystemVersion) +} + +func (a *OpenvSwitch) EqualsModel(b model.Model) bool { + c := b.(*OpenvSwitch) + return a.Equals(c) +} + +var _ model.CloneableModel = &OpenvSwitch{} +var _ model.ComparableModel = &OpenvSwitch{} diff --git a/go-controller/pkg/vswitchd/port.go b/go-controller/pkg/vswitchd/port.go new file mode 100644 index 00000000000..cf0ba961536 --- /dev/null +++ b/go-controller/pkg/vswitchd/port.go @@ -0,0 +1,570 @@ +// Code generated by "libovsdb.modelgen" +// DO NOT EDIT. + +package vswitchd + +import "github.com/ovn-org/libovsdb/model" + +const PortTable = "Port" + +type ( + PortBondMode = string + PortLACP = string + PortVLANMode = string +) + +var ( + PortBondModeBalanceTCP PortBondMode = "balance-tcp" + PortBondModeBalanceSLB PortBondMode = "balance-slb" + PortBondModeActiveBackup PortBondMode = "active-backup" + PortLACPActive PortLACP = "active" + PortLACPPassive PortLACP = "passive" + PortLACPOff PortLACP = "off" + PortVLANModeTrunk PortVLANMode = "trunk" + PortVLANModeAccess PortVLANMode = "access" + PortVLANModeNativeTagged PortVLANMode = "native-tagged" + PortVLANModeNativeUntagged PortVLANMode = "native-untagged" + PortVLANModeDot1qTunnel PortVLANMode = "dot1q-tunnel" +) + +// Port defines an object in Port table +type Port struct { + UUID string `ovsdb:"_uuid"` + BondActiveSlave *string `ovsdb:"bond_active_slave"` + BondDowndelay int `ovsdb:"bond_downdelay"` + BondFakeIface bool `ovsdb:"bond_fake_iface"` + BondMode *PortBondMode `ovsdb:"bond_mode"` + BondUpdelay int `ovsdb:"bond_updelay"` + CVLANs []int `ovsdb:"cvlans"` + ExternalIDs map[string]string `ovsdb:"external_ids"` + FakeBridge bool `ovsdb:"fake_bridge"` + Interfaces []string `ovsdb:"interfaces"` + LACP *PortLACP `ovsdb:"lacp"` + MAC *string `ovsdb:"mac"` + Name string `ovsdb:"name"` + OtherConfig map[string]string `ovsdb:"other_config"` + Protected bool `ovsdb:"protected"` + QOS *string `ovsdb:"qos"` + RSTPStatistics map[string]int `ovsdb:"rstp_statistics"` + RSTPStatus map[string]string `ovsdb:"rstp_status"` + Statistics map[string]int `ovsdb:"statistics"` + Status map[string]string `ovsdb:"status"` + Tag *int `ovsdb:"tag"` + Trunks []int `ovsdb:"trunks"` + VLANMode *PortVLANMode `ovsdb:"vlan_mode"` +} + +func (a *Port) GetUUID() string { + return a.UUID +} + +func (a *Port) GetBondActiveSlave() *string { + return a.BondActiveSlave +} + +func copyPortBondActiveSlave(a *string) *string { + if a == nil { + return nil + } + b := *a + return &b +} + +func equalPortBondActiveSlave(a, b *string) bool { + if (a == nil) != (b == nil) { + return false + } + if a == b { + return true + } + return *a == *b +} + +func (a *Port) GetBondDowndelay() int { + return a.BondDowndelay +} + +func (a *Port) GetBondFakeIface() bool { + return a.BondFakeIface +} + +func (a *Port) GetBondMode() *PortBondMode { + return a.BondMode +} + +func copyPortBondMode(a *PortBondMode) *PortBondMode { + if a == nil { + return nil + } + b := *a + return &b +} + +func equalPortBondMode(a, b *PortBondMode) bool { + if (a == nil) != (b == nil) { + return false + } + if a == b { + return true + } + return *a == *b +} + +func (a *Port) GetBondUpdelay() int { + return a.BondUpdelay +} + +func (a *Port) GetCVLANs() []int { + return a.CVLANs +} + +func copyPortCVLANs(a []int) []int { + if a == nil { + return nil + } + b := make([]int, len(a)) + copy(b, a) + return b +} + +func equalPortCVLANs(a, b []int) bool { + if (a == nil) != (b == nil) { + return false + } + if len(a) != len(b) { + return false + } + for i, v := range a { + if b[i] != v { + return false + } + } + return true +} + +func (a *Port) GetExternalIDs() map[string]string { + return a.ExternalIDs +} + +func copyPortExternalIDs(a map[string]string) map[string]string { + if a == nil { + return nil + } + b := make(map[string]string, len(a)) + for k, v := range a { + b[k] = v + } + return b +} + +func equalPortExternalIDs(a, b map[string]string) bool { + if (a == nil) != (b == nil) { + return false + } + if len(a) != len(b) { + return false + } + for k, v := range a { + if w, ok := b[k]; !ok || v != w { + return false + } + } + return true +} + +func (a *Port) GetFakeBridge() bool { + return a.FakeBridge +} + +func (a *Port) GetInterfaces() []string { + return a.Interfaces +} + +func copyPortInterfaces(a []string) []string { + if a == nil { + return nil + } + b := make([]string, len(a)) + copy(b, a) + return b +} + +func equalPortInterfaces(a, b []string) bool { + if (a == nil) != (b == nil) { + return false + } + if len(a) != len(b) { + return false + } + for i, v := range a { + if b[i] != v { + return false + } + } + return true +} + +func (a *Port) GetLACP() *PortLACP { + return a.LACP +} + +func copyPortLACP(a *PortLACP) *PortLACP { + if a == nil { + return nil + } + b := *a + return &b +} + +func equalPortLACP(a, b *PortLACP) bool { + if (a == nil) != (b == nil) { + return false + } + if a == b { + return true + } + return *a == *b +} + +func (a *Port) GetMAC() *string { + return a.MAC +} + +func copyPortMAC(a *string) *string { + if a == nil { + return nil + } + b := *a + return &b +} + +func equalPortMAC(a, b *string) bool { + if (a == nil) != (b == nil) { + return false + } + if a == b { + return true + } + return *a == *b +} + +func (a *Port) GetName() string { + return a.Name +} + +func (a *Port) GetOtherConfig() map[string]string { + return a.OtherConfig +} + +func copyPortOtherConfig(a map[string]string) map[string]string { + if a == nil { + return nil + } + b := make(map[string]string, len(a)) + for k, v := range a { + b[k] = v + } + return b +} + +func equalPortOtherConfig(a, b map[string]string) bool { + if (a == nil) != (b == nil) { + return false + } + if len(a) != len(b) { + return false + } + for k, v := range a { + if w, ok := b[k]; !ok || v != w { + return false + } + } + return true +} + +func (a *Port) GetProtected() bool { + return a.Protected +} + +func (a *Port) GetQOS() *string { + return a.QOS +} + +func copyPortQOS(a *string) *string { + if a == nil { + return nil + } + b := *a + return &b +} + +func equalPortQOS(a, b *string) bool { + if (a == nil) != (b == nil) { + return false + } + if a == b { + return true + } + return *a == *b +} + +func (a *Port) GetRSTPStatistics() map[string]int { + return a.RSTPStatistics +} + +func copyPortRSTPStatistics(a map[string]int) map[string]int { + if a == nil { + return nil + } + b := make(map[string]int, len(a)) + for k, v := range a { + b[k] = v + } + return b +} + +func equalPortRSTPStatistics(a, b map[string]int) bool { + if (a == nil) != (b == nil) { + return false + } + if len(a) != len(b) { + return false + } + for k, v := range a { + if w, ok := b[k]; !ok || v != w { + return false + } + } + return true +} + +func (a *Port) GetRSTPStatus() map[string]string { + return a.RSTPStatus +} + +func copyPortRSTPStatus(a map[string]string) map[string]string { + if a == nil { + return nil + } + b := make(map[string]string, len(a)) + for k, v := range a { + b[k] = v + } + return b +} + +func equalPortRSTPStatus(a, b map[string]string) bool { + if (a == nil) != (b == nil) { + return false + } + if len(a) != len(b) { + return false + } + for k, v := range a { + if w, ok := b[k]; !ok || v != w { + return false + } + } + return true +} + +func (a *Port) GetStatistics() map[string]int { + return a.Statistics +} + +func copyPortStatistics(a map[string]int) map[string]int { + if a == nil { + return nil + } + b := make(map[string]int, len(a)) + for k, v := range a { + b[k] = v + } + return b +} + +func equalPortStatistics(a, b map[string]int) bool { + if (a == nil) != (b == nil) { + return false + } + if len(a) != len(b) { + return false + } + for k, v := range a { + if w, ok := b[k]; !ok || v != w { + return false + } + } + return true +} + +func (a *Port) GetStatus() map[string]string { + return a.Status +} + +func copyPortStatus(a map[string]string) map[string]string { + if a == nil { + return nil + } + b := make(map[string]string, len(a)) + for k, v := range a { + b[k] = v + } + return b +} + +func equalPortStatus(a, b map[string]string) bool { + if (a == nil) != (b == nil) { + return false + } + if len(a) != len(b) { + return false + } + for k, v := range a { + if w, ok := b[k]; !ok || v != w { + return false + } + } + return true +} + +func (a *Port) GetTag() *int { + return a.Tag +} + +func copyPortTag(a *int) *int { + if a == nil { + return nil + } + b := *a + return &b +} + +func equalPortTag(a, b *int) bool { + if (a == nil) != (b == nil) { + return false + } + if a == b { + return true + } + return *a == *b +} + +func (a *Port) GetTrunks() []int { + return a.Trunks +} + +func copyPortTrunks(a []int) []int { + if a == nil { + return nil + } + b := make([]int, len(a)) + copy(b, a) + return b +} + +func equalPortTrunks(a, b []int) bool { + if (a == nil) != (b == nil) { + return false + } + if len(a) != len(b) { + return false + } + for i, v := range a { + if b[i] != v { + return false + } + } + return true +} + +func (a *Port) GetVLANMode() *PortVLANMode { + return a.VLANMode +} + +func copyPortVLANMode(a *PortVLANMode) *PortVLANMode { + if a == nil { + return nil + } + b := *a + return &b +} + +func equalPortVLANMode(a, b *PortVLANMode) bool { + if (a == nil) != (b == nil) { + return false + } + if a == b { + return true + } + return *a == *b +} + +func (a *Port) DeepCopyInto(b *Port) { + *b = *a + b.BondActiveSlave = copyPortBondActiveSlave(a.BondActiveSlave) + b.BondMode = copyPortBondMode(a.BondMode) + b.CVLANs = copyPortCVLANs(a.CVLANs) + b.ExternalIDs = copyPortExternalIDs(a.ExternalIDs) + b.Interfaces = copyPortInterfaces(a.Interfaces) + b.LACP = copyPortLACP(a.LACP) + b.MAC = copyPortMAC(a.MAC) + b.OtherConfig = copyPortOtherConfig(a.OtherConfig) + b.QOS = copyPortQOS(a.QOS) + b.RSTPStatistics = copyPortRSTPStatistics(a.RSTPStatistics) + b.RSTPStatus = copyPortRSTPStatus(a.RSTPStatus) + b.Statistics = copyPortStatistics(a.Statistics) + b.Status = copyPortStatus(a.Status) + b.Tag = copyPortTag(a.Tag) + b.Trunks = copyPortTrunks(a.Trunks) + b.VLANMode = copyPortVLANMode(a.VLANMode) +} + +func (a *Port) DeepCopy() *Port { + b := new(Port) + a.DeepCopyInto(b) + return b +} + +func (a *Port) CloneModelInto(b model.Model) { + c := b.(*Port) + a.DeepCopyInto(c) +} + +func (a *Port) CloneModel() model.Model { + return a.DeepCopy() +} + +func (a *Port) Equals(b *Port) bool { + return a.UUID == b.UUID && + equalPortBondActiveSlave(a.BondActiveSlave, b.BondActiveSlave) && + a.BondDowndelay == b.BondDowndelay && + a.BondFakeIface == b.BondFakeIface && + equalPortBondMode(a.BondMode, b.BondMode) && + a.BondUpdelay == b.BondUpdelay && + equalPortCVLANs(a.CVLANs, b.CVLANs) && + equalPortExternalIDs(a.ExternalIDs, b.ExternalIDs) && + a.FakeBridge == b.FakeBridge && + equalPortInterfaces(a.Interfaces, b.Interfaces) && + equalPortLACP(a.LACP, b.LACP) && + equalPortMAC(a.MAC, b.MAC) && + a.Name == b.Name && + equalPortOtherConfig(a.OtherConfig, b.OtherConfig) && + a.Protected == b.Protected && + equalPortQOS(a.QOS, b.QOS) && + equalPortRSTPStatistics(a.RSTPStatistics, b.RSTPStatistics) && + equalPortRSTPStatus(a.RSTPStatus, b.RSTPStatus) && + equalPortStatistics(a.Statistics, b.Statistics) && + equalPortStatus(a.Status, b.Status) && + equalPortTag(a.Tag, b.Tag) && + equalPortTrunks(a.Trunks, b.Trunks) && + equalPortVLANMode(a.VLANMode, b.VLANMode) +} + +func (a *Port) EqualsModel(b model.Model) bool { + c := b.(*Port) + return a.Equals(c) +} + +var _ model.CloneableModel = &Port{} +var _ model.ComparableModel = &Port{} diff --git a/go-controller/pkg/vswitchd/qos.go b/go-controller/pkg/vswitchd/qos.go new file mode 100644 index 00000000000..aa1c9dd0040 --- /dev/null +++ b/go-controller/pkg/vswitchd/qos.go @@ -0,0 +1,153 @@ +// Code generated by "libovsdb.modelgen" +// DO NOT EDIT. + +package vswitchd + +import "github.com/ovn-org/libovsdb/model" + +const QoSTable = "QoS" + +// QoS defines an object in QoS table +type QoS struct { + UUID string `ovsdb:"_uuid"` + ExternalIDs map[string]string `ovsdb:"external_ids"` + OtherConfig map[string]string `ovsdb:"other_config"` + Queues map[int]string `ovsdb:"queues"` + Type string `ovsdb:"type"` +} + +func (a *QoS) GetUUID() string { + return a.UUID +} + +func (a *QoS) GetExternalIDs() map[string]string { + return a.ExternalIDs +} + +func copyQoSExternalIDs(a map[string]string) map[string]string { + if a == nil { + return nil + } + b := make(map[string]string, len(a)) + for k, v := range a { + b[k] = v + } + return b +} + +func equalQoSExternalIDs(a, b map[string]string) bool { + if (a == nil) != (b == nil) { + return false + } + if len(a) != len(b) { + return false + } + for k, v := range a { + if w, ok := b[k]; !ok || v != w { + return false + } + } + return true +} + +func (a *QoS) GetOtherConfig() map[string]string { + return a.OtherConfig +} + +func copyQoSOtherConfig(a map[string]string) map[string]string { + if a == nil { + return nil + } + b := make(map[string]string, len(a)) + for k, v := range a { + b[k] = v + } + return b +} + +func equalQoSOtherConfig(a, b map[string]string) bool { + if (a == nil) != (b == nil) { + return false + } + if len(a) != len(b) { + return false + } + for k, v := range a { + if w, ok := b[k]; !ok || v != w { + return false + } + } + return true +} + +func (a *QoS) GetQueues() map[int]string { + return a.Queues +} + +func copyQoSQueues(a map[int]string) map[int]string { + if a == nil { + return nil + } + b := make(map[int]string, len(a)) + for k, v := range a { + b[k] = v + } + return b +} + +func equalQoSQueues(a, b map[int]string) bool { + if (a == nil) != (b == nil) { + return false + } + if len(a) != len(b) { + return false + } + for k, v := range a { + if w, ok := b[k]; !ok || v != w { + return false + } + } + return true +} + +func (a *QoS) GetType() string { + return a.Type +} + +func (a *QoS) DeepCopyInto(b *QoS) { + *b = *a + b.ExternalIDs = copyQoSExternalIDs(a.ExternalIDs) + b.OtherConfig = copyQoSOtherConfig(a.OtherConfig) + b.Queues = copyQoSQueues(a.Queues) +} + +func (a *QoS) DeepCopy() *QoS { + b := new(QoS) + a.DeepCopyInto(b) + return b +} + +func (a *QoS) CloneModelInto(b model.Model) { + c := b.(*QoS) + a.DeepCopyInto(c) +} + +func (a *QoS) CloneModel() model.Model { + return a.DeepCopy() +} + +func (a *QoS) Equals(b *QoS) bool { + return a.UUID == b.UUID && + equalQoSExternalIDs(a.ExternalIDs, b.ExternalIDs) && + equalQoSOtherConfig(a.OtherConfig, b.OtherConfig) && + equalQoSQueues(a.Queues, b.Queues) && + a.Type == b.Type +} + +func (a *QoS) EqualsModel(b model.Model) bool { + c := b.(*QoS) + return a.Equals(c) +} + +var _ model.CloneableModel = &QoS{} +var _ model.ComparableModel = &QoS{} diff --git a/go-controller/pkg/vswitchd/queue.go b/go-controller/pkg/vswitchd/queue.go new file mode 100644 index 00000000000..e8615e9cf74 --- /dev/null +++ b/go-controller/pkg/vswitchd/queue.go @@ -0,0 +1,139 @@ +// Code generated by "libovsdb.modelgen" +// DO NOT EDIT. + +package vswitchd + +import "github.com/ovn-org/libovsdb/model" + +const QueueTable = "Queue" + +// Queue defines an object in Queue table +type Queue struct { + UUID string `ovsdb:"_uuid"` + DSCP *int `ovsdb:"dscp"` + ExternalIDs map[string]string `ovsdb:"external_ids"` + OtherConfig map[string]string `ovsdb:"other_config"` +} + +func (a *Queue) GetUUID() string { + return a.UUID +} + +func (a *Queue) GetDSCP() *int { + return a.DSCP +} + +func copyQueueDSCP(a *int) *int { + if a == nil { + return nil + } + b := *a + return &b +} + +func equalQueueDSCP(a, b *int) bool { + if (a == nil) != (b == nil) { + return false + } + if a == b { + return true + } + return *a == *b +} + +func (a *Queue) GetExternalIDs() map[string]string { + return a.ExternalIDs +} + +func copyQueueExternalIDs(a map[string]string) map[string]string { + if a == nil { + return nil + } + b := make(map[string]string, len(a)) + for k, v := range a { + b[k] = v + } + return b +} + +func equalQueueExternalIDs(a, b map[string]string) bool { + if (a == nil) != (b == nil) { + return false + } + if len(a) != len(b) { + return false + } + for k, v := range a { + if w, ok := b[k]; !ok || v != w { + return false + } + } + return true +} + +func (a *Queue) GetOtherConfig() map[string]string { + return a.OtherConfig +} + +func copyQueueOtherConfig(a map[string]string) map[string]string { + if a == nil { + return nil + } + b := make(map[string]string, len(a)) + for k, v := range a { + b[k] = v + } + return b +} + +func equalQueueOtherConfig(a, b map[string]string) bool { + if (a == nil) != (b == nil) { + return false + } + if len(a) != len(b) { + return false + } + for k, v := range a { + if w, ok := b[k]; !ok || v != w { + return false + } + } + return true +} + +func (a *Queue) DeepCopyInto(b *Queue) { + *b = *a + b.DSCP = copyQueueDSCP(a.DSCP) + b.ExternalIDs = copyQueueExternalIDs(a.ExternalIDs) + b.OtherConfig = copyQueueOtherConfig(a.OtherConfig) +} + +func (a *Queue) DeepCopy() *Queue { + b := new(Queue) + a.DeepCopyInto(b) + return b +} + +func (a *Queue) CloneModelInto(b model.Model) { + c := b.(*Queue) + a.DeepCopyInto(c) +} + +func (a *Queue) CloneModel() model.Model { + return a.DeepCopy() +} + +func (a *Queue) Equals(b *Queue) bool { + return a.UUID == b.UUID && + equalQueueDSCP(a.DSCP, b.DSCP) && + equalQueueExternalIDs(a.ExternalIDs, b.ExternalIDs) && + equalQueueOtherConfig(a.OtherConfig, b.OtherConfig) +} + +func (a *Queue) EqualsModel(b model.Model) bool { + c := b.(*Queue) + return a.Equals(c) +} + +var _ model.CloneableModel = &Queue{} +var _ model.ComparableModel = &Queue{} diff --git a/go-controller/pkg/vswitchd/sflow.go b/go-controller/pkg/vswitchd/sflow.go new file mode 100644 index 00000000000..fcbcc8569eb --- /dev/null +++ b/go-controller/pkg/vswitchd/sflow.go @@ -0,0 +1,212 @@ +// Code generated by "libovsdb.modelgen" +// DO NOT EDIT. + +package vswitchd + +import "github.com/ovn-org/libovsdb/model" + +const SFlowTable = "sFlow" + +// SFlow defines an object in sFlow table +type SFlow struct { + UUID string `ovsdb:"_uuid"` + Agent *string `ovsdb:"agent"` + ExternalIDs map[string]string `ovsdb:"external_ids"` + Header *int `ovsdb:"header"` + Polling *int `ovsdb:"polling"` + Sampling *int `ovsdb:"sampling"` + Targets []string `ovsdb:"targets"` +} + +func (a *SFlow) GetUUID() string { + return a.UUID +} + +func (a *SFlow) GetAgent() *string { + return a.Agent +} + +func copySFlowAgent(a *string) *string { + if a == nil { + return nil + } + b := *a + return &b +} + +func equalSFlowAgent(a, b *string) bool { + if (a == nil) != (b == nil) { + return false + } + if a == b { + return true + } + return *a == *b +} + +func (a *SFlow) GetExternalIDs() map[string]string { + return a.ExternalIDs +} + +func copySFlowExternalIDs(a map[string]string) map[string]string { + if a == nil { + return nil + } + b := make(map[string]string, len(a)) + for k, v := range a { + b[k] = v + } + return b +} + +func equalSFlowExternalIDs(a, b map[string]string) bool { + if (a == nil) != (b == nil) { + return false + } + if len(a) != len(b) { + return false + } + for k, v := range a { + if w, ok := b[k]; !ok || v != w { + return false + } + } + return true +} + +func (a *SFlow) GetHeader() *int { + return a.Header +} + +func copySFlowHeader(a *int) *int { + if a == nil { + return nil + } + b := *a + return &b +} + +func equalSFlowHeader(a, b *int) bool { + if (a == nil) != (b == nil) { + return false + } + if a == b { + return true + } + return *a == *b +} + +func (a *SFlow) GetPolling() *int { + return a.Polling +} + +func copySFlowPolling(a *int) *int { + if a == nil { + return nil + } + b := *a + return &b +} + +func equalSFlowPolling(a, b *int) bool { + if (a == nil) != (b == nil) { + return false + } + if a == b { + return true + } + return *a == *b +} + +func (a *SFlow) GetSampling() *int { + return a.Sampling +} + +func copySFlowSampling(a *int) *int { + if a == nil { + return nil + } + b := *a + return &b +} + +func equalSFlowSampling(a, b *int) bool { + if (a == nil) != (b == nil) { + return false + } + if a == b { + return true + } + return *a == *b +} + +func (a *SFlow) GetTargets() []string { + return a.Targets +} + +func copySFlowTargets(a []string) []string { + if a == nil { + return nil + } + b := make([]string, len(a)) + copy(b, a) + return b +} + +func equalSFlowTargets(a, b []string) bool { + if (a == nil) != (b == nil) { + return false + } + if len(a) != len(b) { + return false + } + for i, v := range a { + if b[i] != v { + return false + } + } + return true +} + +func (a *SFlow) DeepCopyInto(b *SFlow) { + *b = *a + b.Agent = copySFlowAgent(a.Agent) + b.ExternalIDs = copySFlowExternalIDs(a.ExternalIDs) + b.Header = copySFlowHeader(a.Header) + b.Polling = copySFlowPolling(a.Polling) + b.Sampling = copySFlowSampling(a.Sampling) + b.Targets = copySFlowTargets(a.Targets) +} + +func (a *SFlow) DeepCopy() *SFlow { + b := new(SFlow) + a.DeepCopyInto(b) + return b +} + +func (a *SFlow) CloneModelInto(b model.Model) { + c := b.(*SFlow) + a.DeepCopyInto(c) +} + +func (a *SFlow) CloneModel() model.Model { + return a.DeepCopy() +} + +func (a *SFlow) Equals(b *SFlow) bool { + return a.UUID == b.UUID && + equalSFlowAgent(a.Agent, b.Agent) && + equalSFlowExternalIDs(a.ExternalIDs, b.ExternalIDs) && + equalSFlowHeader(a.Header, b.Header) && + equalSFlowPolling(a.Polling, b.Polling) && + equalSFlowSampling(a.Sampling, b.Sampling) && + equalSFlowTargets(a.Targets, b.Targets) +} + +func (a *SFlow) EqualsModel(b model.Model) bool { + c := b.(*SFlow) + return a.Equals(c) +} + +var _ model.CloneableModel = &SFlow{} +var _ model.ComparableModel = &SFlow{} diff --git a/go-controller/pkg/vswitchd/ssl.go b/go-controller/pkg/vswitchd/ssl.go new file mode 100644 index 00000000000..79c4b1bad49 --- /dev/null +++ b/go-controller/pkg/vswitchd/ssl.go @@ -0,0 +1,105 @@ +// Code generated by "libovsdb.modelgen" +// DO NOT EDIT. + +package vswitchd + +import "github.com/ovn-org/libovsdb/model" + +const SSLTable = "SSL" + +// SSL defines an object in SSL table +type SSL struct { + UUID string `ovsdb:"_uuid"` + BootstrapCaCert bool `ovsdb:"bootstrap_ca_cert"` + CaCert string `ovsdb:"ca_cert"` + Certificate string `ovsdb:"certificate"` + ExternalIDs map[string]string `ovsdb:"external_ids"` + PrivateKey string `ovsdb:"private_key"` +} + +func (a *SSL) GetUUID() string { + return a.UUID +} + +func (a *SSL) GetBootstrapCaCert() bool { + return a.BootstrapCaCert +} + +func (a *SSL) GetCaCert() string { + return a.CaCert +} + +func (a *SSL) GetCertificate() string { + return a.Certificate +} + +func (a *SSL) GetExternalIDs() map[string]string { + return a.ExternalIDs +} + +func copySSLExternalIDs(a map[string]string) map[string]string { + if a == nil { + return nil + } + b := make(map[string]string, len(a)) + for k, v := range a { + b[k] = v + } + return b +} + +func equalSSLExternalIDs(a, b map[string]string) bool { + if (a == nil) != (b == nil) { + return false + } + if len(a) != len(b) { + return false + } + for k, v := range a { + if w, ok := b[k]; !ok || v != w { + return false + } + } + return true +} + +func (a *SSL) GetPrivateKey() string { + return a.PrivateKey +} + +func (a *SSL) DeepCopyInto(b *SSL) { + *b = *a + b.ExternalIDs = copySSLExternalIDs(a.ExternalIDs) +} + +func (a *SSL) DeepCopy() *SSL { + b := new(SSL) + a.DeepCopyInto(b) + return b +} + +func (a *SSL) CloneModelInto(b model.Model) { + c := b.(*SSL) + a.DeepCopyInto(c) +} + +func (a *SSL) CloneModel() model.Model { + return a.DeepCopy() +} + +func (a *SSL) Equals(b *SSL) bool { + return a.UUID == b.UUID && + a.BootstrapCaCert == b.BootstrapCaCert && + a.CaCert == b.CaCert && + a.Certificate == b.Certificate && + equalSSLExternalIDs(a.ExternalIDs, b.ExternalIDs) && + a.PrivateKey == b.PrivateKey +} + +func (a *SSL) EqualsModel(b model.Model) bool { + c := b.(*SSL) + return a.Equals(c) +} + +var _ model.CloneableModel = &SSL{} +var _ model.ComparableModel = &SSL{} diff --git a/go-controller/pkg/vswitchd/vswitch.ovsschema b/go-controller/pkg/vswitchd/vswitch.ovsschema new file mode 100644 index 00000000000..4873cfde72d --- /dev/null +++ b/go-controller/pkg/vswitchd/vswitch.ovsschema @@ -0,0 +1,720 @@ +{"name": "Open_vSwitch", + "version": "8.3.0", + "cksum": "3781850481 26690", + "tables": { + "Open_vSwitch": { + "columns": { + "datapaths": { + "type": {"key": {"type": "string"}, + "value": {"type": "uuid", + "refTable": "Datapath"}, + "min": 0, "max": "unlimited"}}, + "bridges": { + "type": {"key": {"type": "uuid", + "refTable": "Bridge"}, + "min": 0, "max": "unlimited"}}, + "manager_options": { + "type": {"key": {"type": "uuid", + "refTable": "Manager"}, + "min": 0, "max": "unlimited"}}, + "ssl": { + "type": {"key": {"type": "uuid", + "refTable": "SSL"}, + "min": 0, "max": 1}}, + "other_config": { + "type": {"key": "string", "value": "string", + "min": 0, "max": "unlimited"}}, + "external_ids": { + "type": {"key": "string", "value": "string", + "min": 0, "max": "unlimited"}}, + "next_cfg": { + "type": "integer"}, + "cur_cfg": { + "type": "integer"}, + "statistics": { + "type": {"key": "string", "value": "string", + "min": 0, "max": "unlimited"}, + "ephemeral": true}, + "ovs_version": { + "type": {"key": {"type": "string"}, + "min": 0, "max": 1}}, + "db_version": { + "type": {"key": {"type": "string"}, + "min": 0, "max": 1}}, + "system_type": { + "type": {"key": {"type": "string"}, + "min": 0, "max": 1}}, + "system_version": { + "type": {"key": {"type": "string"}, + "min": 0, "max": 1}}, + "datapath_types": { + "type": {"key": {"type": "string"}, + "min": 0, "max": "unlimited"}}, + "iface_types": { + "type": {"key": {"type": "string"}, + "min": 0, "max": "unlimited"}}, + "dpdk_initialized": { + "type": "boolean"}, + "dpdk_version": { + "type": {"key": {"type": "string"}, + "min": 0, "max": 1}}}, + "isRoot": true, + "maxRows": 1}, + "Bridge": { + "columns": { + "name": { + "type": "string", + "mutable": false}, + "datapath_type": { + "type": "string"}, + "datapath_version": { + "type": "string"}, + "datapath_id": { + "type": {"key": "string", "min": 0, "max": 1}, + "ephemeral": true}, + "stp_enable": { + "type": "boolean"}, + "rstp_enable": { + "type": "boolean"}, + "mcast_snooping_enable": { + "type": "boolean"}, + "ports": { + "type": {"key": {"type": "uuid", + "refTable": "Port"}, + "min": 0, "max": "unlimited"}}, + "mirrors": { + "type": {"key": {"type": "uuid", + "refTable": "Mirror"}, + "min": 0, "max": "unlimited"}}, + "netflow": { + "type": {"key": {"type": "uuid", + "refTable": "NetFlow"}, + "min": 0, "max": 1}}, + "sflow": { + "type": {"key": {"type": "uuid", + "refTable": "sFlow"}, + "min": 0, "max": 1}}, + "ipfix": { + "type": {"key": {"type": "uuid", + "refTable": "IPFIX"}, + "min": 0, "max": 1}}, + "controller": { + "type": {"key": {"type": "uuid", + "refTable": "Controller"}, + "min": 0, "max": "unlimited"}}, + "protocols": { + "type": {"key": {"type": "string", + "enum": ["set", ["OpenFlow10", + "OpenFlow11", + "OpenFlow12", + "OpenFlow13", + "OpenFlow14", + "OpenFlow15"]]}, + "min": 0, "max": "unlimited"}}, + "fail_mode": { + "type": {"key": {"type": "string", + "enum": ["set", ["standalone", "secure"]]}, + "min": 0, "max": 1}}, + "status": { + "type": {"key": "string", "value": "string", + "min": 0, "max": "unlimited"}, + "ephemeral": true}, + "rstp_status": { + "type": {"key": "string", "value": "string", + "min": 0, "max": "unlimited"}, + "ephemeral": true}, + "other_config": { + "type": {"key": "string", "value": "string", + "min": 0, "max": "unlimited"}}, + "external_ids": { + "type": {"key": "string", "value": "string", + "min": 0, "max": "unlimited"}}, + "flood_vlans": { + "type": {"key": {"type": "integer", + "minInteger": 0, + "maxInteger": 4095}, + "min": 0, "max": 4096}}, + "flow_tables": { + "type": {"key": {"type": "integer", + "minInteger": 0, + "maxInteger": 254}, + "value": {"type": "uuid", + "refTable": "Flow_Table"}, + "min": 0, "max": "unlimited"}}, + "auto_attach": { + "type": {"key": {"type": "uuid", + "refTable": "AutoAttach"}, + "min": 0, "max": 1}}}, + "indexes": [["name"]]}, + "Port": { + "columns": { + "name": { + "type": "string", + "mutable": false}, + "interfaces": { + "type": {"key": {"type": "uuid", + "refTable": "Interface"}, + "min": 1, "max": "unlimited"}}, + "trunks": { + "type": {"key": {"type": "integer", + "minInteger": 0, + "maxInteger": 4095}, + "min": 0, "max": 4096}}, + "cvlans": { + "type": {"key": {"type": "integer", + "minInteger": 0, + "maxInteger": 4095}, + "min": 0, "max": 4096}}, + "tag": { + "type": {"key": {"type": "integer", + "minInteger": 0, + "maxInteger": 4095}, + "min": 0, "max": 1}}, + "vlan_mode": { + "type": {"key": {"type": "string", + "enum": ["set", ["trunk", "access", "native-tagged", + "native-untagged", "dot1q-tunnel"]]}, + "min": 0, "max": 1}}, + "qos": { + "type": {"key": {"type": "uuid", + "refTable": "QoS"}, + "min": 0, "max": 1}}, + "mac": { + "type": {"key": {"type": "string"}, + "min": 0, "max": 1}}, + "bond_mode": { + "type": {"key": {"type": "string", + "enum": ["set", ["balance-tcp", "balance-slb", "active-backup"]]}, + "min": 0, "max": 1}}, + "lacp": { + "type": {"key": {"type": "string", + "enum": ["set", ["active", "passive", "off"]]}, + "min": 0, "max": 1}}, + "bond_updelay": { + "type": "integer"}, + "bond_downdelay": { + "type": "integer"}, + "bond_active_slave": { + "type": {"key": {"type": "string"}, + "min": 0, "max": 1}}, + "bond_fake_iface": { + "type": "boolean"}, + "fake_bridge": { + "type": "boolean"}, + "status": { + "type": {"key": "string", "value": "string", + "min": 0, "max": "unlimited"}, + "ephemeral": true}, + "rstp_status": { + "type": {"key": "string", "value": "string", + "min": 0, "max": "unlimited"}, + "ephemeral": true}, + "rstp_statistics": { + "type": {"key": "string", "value": "integer", + "min": 0, "max": "unlimited"}, + "ephemeral": true}, + "statistics": { + "type": {"key": "string", "value": "integer", + "min": 0, "max": "unlimited"}, + "ephemeral": true}, + "protected": { + "type": "boolean"}, + "other_config": { + "type": {"key": "string", "value": "string", + "min": 0, "max": "unlimited"}}, + "external_ids": { + "type": {"key": "string", "value": "string", + "min": 0, "max": "unlimited"}}}, + "indexes": [["name"]]}, + "Interface": { + "columns": { + "name": { + "type": "string", + "mutable": false}, + "type": { + "type": "string"}, + "options": { + "type": {"key": "string", "value": "string", + "min": 0, "max": "unlimited"}}, + "ingress_policing_rate": { + "type": {"key": {"type": "integer", + "minInteger": 0}}}, + "ingress_policing_burst": { + "type": {"key": {"type": "integer", + "minInteger": 0}}}, + "ingress_policing_kpkts_rate": { + "type": {"key": {"type": "integer", + "minInteger": 0}}}, + "ingress_policing_kpkts_burst": { + "type": {"key": {"type": "integer", + "minInteger": 0}}}, + "mac_in_use": { + "type": {"key": {"type": "string"}, + "min": 0, "max": 1}, + "ephemeral": true}, + "mac": { + "type": {"key": {"type": "string"}, + "min": 0, "max": 1}}, + "ifindex": { + "type": { + "key": {"type": "integer", + "minInteger": 0, + "maxInteger": 4294967295}, + "min": 0, + "max": 1}, + "ephemeral": true}, + "external_ids": { + "type": {"key": "string", "value": "string", + "min": 0, "max": "unlimited"}}, + "ofport": { + "type": {"key": "integer", "min": 0, "max": 1}}, + "ofport_request": { + "type": { + "key": {"type": "integer", + "minInteger": 1, + "maxInteger": 65279}, + "min": 0, + "max": 1}}, + "bfd": { + "type": {"key": "string", "value": "string", + "min": 0, "max": "unlimited"}}, + "bfd_status": { + "type": {"key": "string", "value": "string", + "min": 0, "max": "unlimited"}}, + "cfm_mpid": { + "type": { + "key": {"type": "integer"}, + "min": 0, + "max": 1}}, + "cfm_remote_mpids": { + "type": { + "key": {"type": "integer"}, + "min": 0, + "max": "unlimited"}, + "ephemeral": true}, + "cfm_flap_count": { + "type": { + "key": {"type": "integer"}, + "min": 0, + "max": 1}}, + "cfm_fault": { + "type": { + "key": { "type": "boolean"}, + "min": 0, + "max": 1}, + "ephemeral": true}, + "cfm_fault_status": { + "type": { + "key": "string", "min": 0, "max": "unlimited"}, + "ephemeral": true}, + "cfm_remote_opstate": { + "type": {"key": {"type": "string", + "enum": ["set", ["up", "down"]]}, + "min": 0, "max": 1}, + "ephemeral": true}, + "cfm_health": { + "type": {"key": {"type": "integer", + "minInteger": 0, + "maxInteger": 100}, + "min": 0, "max": 1}, + "ephemeral": true}, + "lacp_current": { + "type": {"key": {"type": "boolean"}, + "min": 0, "max": 1}, + "ephemeral": true}, + "lldp": { + "type": {"key": "string", "value": "string", + "min": 0, "max": "unlimited"}}, + "other_config": { + "type": {"key": "string", "value": "string", + "min": 0, "max": "unlimited"}}, + "statistics": { + "type": {"key": "string", "value": "integer", + "min": 0, "max": "unlimited"}, + "ephemeral": true}, + "status": { + "type": {"key": "string", "value": "string", + "min": 0, "max": "unlimited"}, + "ephemeral": true}, + "admin_state": { + "type": {"key": {"type": "string", + "enum": ["set", ["up", "down"]]}, + "min": 0, "max": 1}, + "ephemeral": true}, + "link_state": { + "type": {"key": {"type": "string", + "enum": ["set", ["up", "down"]]}, + "min": 0, "max": 1}, + "ephemeral": true}, + "link_resets": { + "type": {"key": {"type": "integer"}, + "min": 0, "max": 1}, + "ephemeral": true}, + "link_speed": { + "type": {"key": "integer", "min": 0, "max": 1}, + "ephemeral": true}, + "duplex": { + "type": {"key": {"type": "string", + "enum": ["set", ["half", "full"]]}, + "min": 0, "max": 1}, + "ephemeral": true}, + "mtu": { + "type": {"key": "integer", "min": 0, "max": 1}, + "ephemeral": true}, + "mtu_request": { + "type": { + "key": {"type": "integer", + "minInteger": 1}, + "min": 0, + "max": 1}}, + "error": { + "type": {"key": "string", "min": 0, "max": 1}}}, + "indexes": [["name"]]}, + "Flow_Table": { + "columns": { + "name": { + "type": {"key": "string", "min": 0, "max": 1}}, + "flow_limit": { + "type": {"key": {"type": "integer", "minInteger": 0}, + "min": 0, "max": 1}}, + "overflow_policy": { + "type": {"key": {"type": "string", + "enum": ["set", ["refuse", "evict"]]}, + "min": 0, "max": 1}}, + "groups": { + "type": {"key": "string", "min": 0, "max": "unlimited"}}, + "prefixes": { + "type": {"key": "string", "min": 0, "max": 3}}, + "external_ids": { + "type": {"key": "string", "value": "string", + "min": 0, "max": "unlimited"}}}}, + "QoS": { + "columns": { + "type": { + "type": "string"}, + "queues": { + "type": {"key": {"type": "integer", + "minInteger": 0, + "maxInteger": 4294967295}, + "value": {"type": "uuid", + "refTable": "Queue"}, + "min": 0, "max": "unlimited"}}, + "other_config": { + "type": {"key": "string", "value": "string", + "min": 0, "max": "unlimited"}}, + "external_ids": { + "type": {"key": "string", "value": "string", + "min": 0, "max": "unlimited"}}}, + "isRoot": true}, + "Queue": { + "columns": { + "dscp": { + "type": {"key": {"type": "integer", + "minInteger": 0, + "maxInteger": 63}, + "min": 0, "max": 1}}, + "other_config": { + "type": {"key": "string", "value": "string", + "min": 0, "max": "unlimited"}}, + "external_ids": { + "type": {"key": "string", "value": "string", + "min": 0, "max": "unlimited"}}}, + "isRoot": true}, + "Mirror": { + "columns": { + "name": { + "type": "string"}, + "select_all": { + "type": "boolean"}, + "select_src_port": { + "type": {"key": {"type": "uuid", + "refTable": "Port", + "refType": "weak"}, + "min": 0, "max": "unlimited"}}, + "select_dst_port": { + "type": {"key": {"type": "uuid", + "refTable": "Port", + "refType": "weak"}, + "min": 0, "max": "unlimited"}}, + "select_vlan": { + "type": {"key": {"type": "integer", + "minInteger": 0, + "maxInteger": 4095}, + "min": 0, "max": 4096}}, + "output_port": { + "type": {"key": {"type": "uuid", + "refTable": "Port", + "refType": "weak"}, + "min": 0, "max": 1}}, + "output_vlan": { + "type": {"key": {"type": "integer", + "minInteger": 1, + "maxInteger": 4095}, + "min": 0, "max": 1}}, + "snaplen": { + "type": {"key": {"type": "integer", + "minInteger": 14, + "maxInteger": 65535}, + "min": 0, "max": 1}}, + "statistics": { + "type": {"key": "string", "value": "integer", + "min": 0, "max": "unlimited"}, + "ephemeral": true}, + "external_ids": { + "type": {"key": "string", "value": "string", + "min": 0, "max": "unlimited"}}}}, + "NetFlow": { + "columns": { + "targets": { + "type": {"key": {"type": "string"}, + "min": 1, "max": "unlimited"}}, + "engine_type": { + "type": {"key": {"type": "integer", + "minInteger": 0, + "maxInteger": 255}, + "min": 0, "max": 1}}, + "engine_id": { + "type": {"key": {"type": "integer", + "minInteger": 0, + "maxInteger": 255}, + "min": 0, "max": 1}}, + "add_id_to_interface": { + "type": "boolean"}, + "active_timeout": { + "type": {"key": {"type": "integer", + "minInteger": -1}}}, + "external_ids": { + "type": {"key": "string", "value": "string", + "min": 0, "max": "unlimited"}}}}, + "sFlow": { + "columns": { + "targets": { + "type": {"key": "string", "min": 1, "max": "unlimited"}}, + "sampling": { + "type": {"key": "integer", "min": 0, "max": 1}}, + "polling": { + "type": {"key": "integer", "min": 0, "max": 1}}, + "header": { + "type": {"key": "integer", "min": 0, "max": 1}}, + "agent": { + "type": {"key": "string", "min": 0, "max": 1}}, + "external_ids": { + "type": {"key": "string", "value": "string", + "min": 0, "max": "unlimited"}}}}, + "IPFIX": { + "columns": { + "targets": { + "type": {"key": "string", "min": 0, "max": "unlimited"}}, + "sampling": { + "type": {"key": {"type": "integer", + "minInteger": 1, + "maxInteger": 4294967295}, + "min": 0, "max": 1}}, + "obs_domain_id": { + "type": {"key": {"type": "integer", + "minInteger": 0, + "maxInteger": 4294967295}, + "min": 0, "max": 1}}, + "obs_point_id": { + "type": {"key": {"type": "integer", + "minInteger": 0, + "maxInteger": 4294967295}, + "min": 0, "max": 1}}, + "cache_active_timeout": { + "type": {"key": {"type": "integer", + "minInteger": 0, + "maxInteger": 4200}, + "min": 0, "max": 1}}, + "cache_max_flows": { + "type": {"key": {"type": "integer", + "minInteger": 0, + "maxInteger": 4294967295}, + "min": 0, "max": 1}}, + "other_config": { + "type": {"key": "string", "value": "string", + "min": 0, "max": "unlimited"}}, + "external_ids": { + "type": {"key": "string", "value": "string", + "min": 0, "max": "unlimited"}}}}, + "Flow_Sample_Collector_Set": { + "columns": { + "id": { + "type": {"key": {"type": "integer", + "minInteger": 0, + "maxInteger": 4294967295}, + "min": 1, "max": 1}}, + "bridge": { + "type": {"key": {"type": "uuid", + "refTable": "Bridge"}, + "min": 1, "max": 1}}, + "ipfix": { + "type": {"key": {"type": "uuid", + "refTable": "IPFIX"}, + "min": 0, "max": 1}}, + "external_ids": { + "type": {"key": "string", "value": "string", + "min": 0, "max": "unlimited"}}}, + "isRoot": true, + "indexes": [["id", "bridge"]]}, + "Controller": { + "columns": { + "type": { + "type": {"key": {"type": "string", + "enum": ["set", ["primary", "service"]]}, + "min": 0, "max": 1}}, + "target": { + "type": "string"}, + "max_backoff": { + "type": {"key": {"type": "integer", + "minInteger": 1000}, + "min": 0, "max": 1}}, + "inactivity_probe": { + "type": {"key": "integer", "min": 0, "max": 1}}, + "connection_mode": { + "type": {"key": {"type": "string", + "enum": ["set", ["in-band", "out-of-band"]]}, + "min": 0, "max": 1}}, + "local_ip": { + "type": {"key": {"type": "string"}, + "min": 0, "max": 1}}, + "local_netmask": { + "type": {"key": {"type": "string"}, + "min": 0, "max": 1}}, + "local_gateway": { + "type": {"key": {"type": "string"}, + "min": 0, "max": 1}}, + "enable_async_messages": { + "type": {"key": {"type": "boolean"}, + "min": 0, "max": 1}}, + "controller_queue_size": { + "type": {"key": {"type": "integer", + "minInteger": 1, + "maxInteger": 512}, + "min": 0, "max": 1}}, + "controller_rate_limit": { + "type": {"key": {"type": "integer", + "minInteger": 100}, + "min": 0, "max": 1}}, + "controller_burst_limit": { + "type": {"key": {"type": "integer", + "minInteger": 25}, + "min": 0, "max": 1}}, + "other_config": { + "type": {"key": "string", "value": "string", + "min": 0, "max": "unlimited"}}, + "external_ids": { + "type": {"key": "string", "value": "string", + "min": 0, "max": "unlimited"}}, + "is_connected": { + "type": "boolean", + "ephemeral": true}, + "role": { + "type": {"key": {"type": "string", + "enum": ["set", ["other", "master", "slave"]]}, + "min": 0, "max": 1}, + "ephemeral": true}, + "status": { + "type": {"key": "string", "value": "string", + "min": 0, "max": "unlimited"}, + "ephemeral": true}}}, + "Manager": { + "columns": { + "target": { + "type": "string"}, + "max_backoff": { + "type": {"key": {"type": "integer", + "minInteger": 1000}, + "min": 0, "max": 1}}, + "inactivity_probe": { + "type": {"key": "integer", "min": 0, "max": 1}}, + "connection_mode": { + "type": {"key": {"type": "string", + "enum": ["set", ["in-band", "out-of-band"]]}, + "min": 0, "max": 1}}, + "other_config": { + "type": {"key": "string", "value": "string", + "min": 0, "max": "unlimited"}}, + "external_ids": { + "type": {"key": "string", "value": "string", + "min": 0, "max": "unlimited"}}, + "is_connected": { + "type": "boolean", + "ephemeral": true}, + "status": { + "type": {"key": "string", "value": "string", + "min": 0, "max": "unlimited"}, + "ephemeral": true}}, + "indexes": [["target"]]}, + "Datapath": { + "columns": { + "datapath_version": { + "type": "string"}, + "ct_zones": { + "type": {"key": {"type": "integer", + "minInteger": 0, + "maxInteger": 65535}, + "value": {"type": "uuid", + "refTable": "CT_Zone"}, + "min": 0, "max": "unlimited"}}, + "capabilities": { + "type": {"key": "string", "value": "string", + "min": 0, "max": "unlimited"}}, + "external_ids": { + "type": {"key": "string", "value": "string", + "min": 0, "max": "unlimited"}}}}, + "CT_Zone": { + "columns": { + "timeout_policy": { + "type": {"key": {"type": "uuid", + "refTable": "CT_Timeout_Policy"}, + "min": 0, "max": 1}}, + "external_ids": { + "type": {"key": "string", "value": "string", + "min": 0, "max": "unlimited"}}}}, + "CT_Timeout_Policy": { + "columns": { + "timeouts": { + "type": {"key": {"type" : "string", + "enum": ["set", ["tcp_syn_sent", "tcp_syn_recv", + "tcp_established", "tcp_fin_wait", + "tcp_close_wait", "tcp_last_ack", + "tcp_time_wait", "tcp_close", + "tcp_syn_sent2", "tcp_retransmit", + "tcp_unack", "udp_first", + "udp_single", "udp_multiple", + "icmp_first", "icmp_reply"]]}, + "value": {"type" : "integer", + "minInteger" : 0, + "maxInteger" : 4294967295}, + "min": 0, "max": "unlimited"}}, + "external_ids": { + "type": {"key": "string", "value": "string", + "min": 0, "max": "unlimited"}}}}, + "SSL": { + "columns": { + "private_key": { + "type": "string"}, + "certificate": { + "type": "string"}, + "ca_cert": { + "type": "string"}, + "bootstrap_ca_cert": { + "type": "boolean"}, + "external_ids": { + "type": {"key": "string", "value": "string", + "min": 0, "max": "unlimited"}}}, + "maxRows": 1}, + "AutoAttach": { + "columns": { + "system_name": { + "type": "string"}, + "system_description": { + "type": "string"}, + "mappings": { + "type": {"key": {"type": "integer", + "minInteger": 0, + "maxInteger": 16777215}, + "value": {"type": "integer", + "minInteger": 0, + "maxInteger": 4095}, + "min": 0, "max": "unlimited"}}}}}}