Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

modelgen: generate constants instead of variables for enums #393

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion modelgen/table.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ type (
{{- end }}
)

var (
const (
{{ range index . "Enums" }}
{{- $e := . }}
{{- range .Sets }}
Expand Down
16 changes: 9 additions & 7 deletions modelgen/table_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ type (
AtomicTableProtocol = string
)

var (
const (
AtomicTableEventTypeEmptyLbBackends AtomicTableEventType = "empty_lb_backends"
AtomicTableProtocolTCP AtomicTableProtocol = "tcp"
AtomicTableProtocolUDP AtomicTableProtocol = "udp"
Expand Down Expand Up @@ -128,7 +128,7 @@ type (
AtomicTableProtocol = string
)

var (
const (
AtomicTableEventTypeEmptyLbBackends AtomicTableEventType = "empty_lb_backends"
AtomicTableProtocolTCP AtomicTableProtocol = "tcp"
AtomicTableProtocolUDP AtomicTableProtocol = "udp"
Expand Down Expand Up @@ -172,7 +172,7 @@ type (
AtomicTableProtocol = string
)

var (
const (
AtomicTableEventTypeEmptyLbBackends AtomicTableEventType = "empty_lb_backends"
AtomicTableProtocolTCP AtomicTableProtocol = "tcp"
AtomicTableProtocolUDP AtomicTableProtocol = "udp"
Expand Down Expand Up @@ -330,7 +330,7 @@ type (
AtomicTableProtocol = string
)

var (
const (
AtomicTableEventTypeEmptyLbBackends AtomicTableEventType = "empty_lb_backends"
AtomicTableProtocolTCP AtomicTableProtocol = "tcp"
AtomicTableProtocolUDP AtomicTableProtocol = "udp"
Expand Down Expand Up @@ -589,7 +589,7 @@ type (
AtomicTableProtocol = string
)

var (
const (
AtomicTableEventTypeEmptyLbBackends AtomicTableEventType = "empty_lb_backends"
AtomicTableProtocolTCP AtomicTableProtocol = "tcp"
AtomicTableProtocolUDP AtomicTableProtocol = "udp"
Expand Down Expand Up @@ -870,15 +870,15 @@ func buildRandStr() *string {
}

func buildTestBridge() *vswitchd.Bridge {
return &vswitchd.Bridge{
bridge := &vswitchd.Bridge{
UUID: *buildRandStr(),
AutoAttach: buildRandStr(),
Controller: []string{*buildRandStr(), *buildRandStr()},
DatapathID: buildRandStr(),
DatapathType: *buildRandStr(),
DatapathVersion: *buildRandStr(),
ExternalIDs: map[string]string{*buildRandStr(): *buildRandStr(), *buildRandStr(): *buildRandStr()},
FailMode: &vswitchd.BridgeFailModeSecure,
FailMode: new(string),
FloodVLANs: []int{0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
FlowTables: map[int]string{1: *buildRandStr(), 2: *buildRandStr()},
IPFIX: buildRandStr(),
Expand All @@ -895,6 +895,8 @@ func buildTestBridge() *vswitchd.Bridge {
Status: map[string]string{*buildRandStr(): *buildRandStr(), *buildRandStr(): *buildRandStr()},
STPEnable: false,
}
*bridge.FailMode = vswitchd.BridgeFailModeSecure
return bridge
}

func buildTestInterface() *vswitchd.Interface {
Expand Down
2 changes: 1 addition & 1 deletion ovsdb/serverdb/database.go

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

Loading