Skip to content

Commit

Permalink
Merge pull request #51 from hawkv6/add-low-utilization
Browse files Browse the repository at this point in the history
Add low utilization intent
severindellsperger authored Apr 12, 2024
2 parents 6c3507f + 8399e79 commit ea66af5
Showing 5 changed files with 53 additions and 28 deletions.
41 changes: 23 additions & 18 deletions pkg/api/intent.pb.go

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

2 changes: 1 addition & 1 deletion pkg/api/intent_grpc.pb.go

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

21 changes: 13 additions & 8 deletions pkg/types/types.go
Original file line number Diff line number Diff line change
@@ -51,14 +51,15 @@ func ParseIntentValueType(s string) (IntentValueType, error) {
type IntentType api.IntentType

const (
IntentTypeUnspecified = IntentType(api.IntentType_INTENT_TYPE_UNSPECIFIED)
IntentTypeHighBandwidth = IntentType(api.IntentType_INTENT_TYPE_HIGH_BANDWIDTH)
IntentTypeLowBandwidth = IntentType(api.IntentType_INTENT_TYPE_LOW_BANDWIDTH)
IntentTypeLowLatency = IntentType(api.IntentType_INTENT_TYPE_LOW_LATENCY)
IntentTypeLowPacketLoss = IntentType(api.IntentType_INTENT_TYPE_LOW_PACKET_LOSS)
IntentTypeLowJitter = IntentType(api.IntentType_INTENT_TYPE_LOW_JITTER)
IntentTypeFlexAlgo = IntentType(api.IntentType_INTENT_TYPE_FLEX_ALGO)
IntentTypeSfc = IntentType(api.IntentType_INTENT_TYPE_SFC)
IntentTypeUnspecified = IntentType(api.IntentType_INTENT_TYPE_UNSPECIFIED)
IntentTypeHighBandwidth = IntentType(api.IntentType_INTENT_TYPE_HIGH_BANDWIDTH)
IntentTypeLowBandwidth = IntentType(api.IntentType_INTENT_TYPE_LOW_BANDWIDTH)
IntentTypeLowLatency = IntentType(api.IntentType_INTENT_TYPE_LOW_LATENCY)
IntentTypeLowPacketLoss = IntentType(api.IntentType_INTENT_TYPE_LOW_PACKET_LOSS)
IntentTypeLowJitter = IntentType(api.IntentType_INTENT_TYPE_LOW_JITTER)
IntentTypeFlexAlgo = IntentType(api.IntentType_INTENT_TYPE_FLEX_ALGO)
IntentTypeSfc = IntentType(api.IntentType_INTENT_TYPE_SFC)
IntentTypeLowUtilization = IntentType(api.IntentType_INTENT_TYPE_LOW_UTILIZATION)
)

func (it IntentType) String() string {
@@ -77,6 +78,8 @@ func (it IntentType) String() string {
return "flex-algo"
case IntentTypeSfc:
return "sfc"
case IntentTypeLowUtilization:
return "low-utilization"
default:
return "unspecified"
}
@@ -100,6 +103,8 @@ func ParseIntentType(s string) (IntentType, error) {
return IntentTypeFlexAlgo, nil
case "sfc":
return IntentTypeSfc, nil
case "low-utilization":
return IntentTypeLowUtilization, nil
default:
return 0, fmt.Errorf("invalid IntentType: %s", s)
}
15 changes: 15 additions & 0 deletions pkg/types/types_test.go
Original file line number Diff line number Diff line change
@@ -224,6 +224,13 @@ func TestIntentTypeToString(t *testing.T) {
},
want: "unspecified",
},
{
name: "IntentTypeLowUtilization",
args: args{
it: IntentTypeLowUtilization,
},
want: "low-utilization",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@@ -332,6 +339,14 @@ func TestParseIntentType(t *testing.T) {
want: IntentTypeUnspecified,
wantErr: true,
},
{
name: "IntentTypeLowUtilization",
args: args{
s: "low-utilization",
},
want: IntentTypeLowUtilization,
wantErr: false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
2 changes: 1 addition & 1 deletion proto
Submodule proto updated 3 files
+201 −0 LICENSE
+4 −1 README.md
+1 −0 intent.proto

0 comments on commit ea66af5

Please sign in to comment.