Commit d066dbcb authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Extended Proto files:

ACL:
- defined generic model for ACLs

Context:
- Extended context.proto with ConnectionSettings
- Extended context.proto with ConfigRules specific for ACLs
Extended context.proto with Constraints for Schedule, Location, and SLAs
- created ContextPolicy to bring persistent storage of policies
- updated genproto.sh

Policy:
- added missing message to list PolicyRuleIds
parent ff0c2adf
Loading
Loading
Loading
Loading

proto/acl.proto

0 → 100644
+69 −0
Original line number Diff line number Diff line
// Copyright 2021-2023 H2020 TeraFlow (https://www.teraflow-h2020.eu/)
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";
package acl;

enum AclRuleTypeEnum {
  ACLRULETYPE_UNDEFINED = 0;
  ACLRULETYPE_IPV4      = 1;
  ACLRULETYPE_IPV6      = 2;
  ACLRULETYPE_L2        = 3;
  ACLRULETYPE_MPLS      = 4;
  ACLRULETYPE_MIXED     = 5;
}

enum AclForwardActionEnum {
  ACLFORWARDINGACTION_UNDEFINED = 0;
  ACLFORWARDINGACTION_DROP      = 1;
  ACLFORWARDINGACTION_ACCEPT    = 2;
  ACLFORWARDINGACTION_REJECT    = 3;
}

enum AclLogActionEnum {
  ACLLOGACTION_UNDEFINED = 0;
  ACLLOGACTION_NOLOG     = 1;
  ACLLOGACTION_SYSLOG    = 2;
}

message AclMatch {
  uint32 dscp             = 1;
  uint32 protocol         = 2;
  string src_address      = 3;
  string dst_address      = 4;
  uint32 src_port         = 5;
  uint32 dst_port         = 6;
  uint32 start_mpls_label = 7;
  uint32 end_mpls_label   = 8;
}

message AclAction {
  AclForwardActionEnum forward_action = 1;
  AclLogActionEnum     log_action     = 2;
}

message AclEntry {
  uint32    sequence_id = 1;
  string    description = 2;
  AclMatch  match       = 3;
  AclAction action      = 4;
}

message AclRuleSet {
  string             name        = 1;
  AclRuleTypeEnum    type        = 2;
  string             description = 3;
  string             user_id     = 4;
  repeated AclEntry  entries     = 5;
}
+28 −0
Original line number Diff line number Diff line
// Copyright 2021-2023 H2020 TeraFlow (https://www.teraflow-h2020.eu/)
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";
package context_policy;

import "context.proto";
import "policy.proto";

// created as a separate service to prevent import-loops in context and policy
service ContextPolicyService {
  rpc ListPolicyRuleIds  (context.Empty      ) returns (       policy.PolicyRuleIdList) {}
  rpc ListPolicyRules    (context.Empty      ) returns (       policy.PolicyRuleList  ) {}
  rpc GetPolicyRule      (policy.PolicyRuleId) returns (       policy.PolicyRule      ) {}
  rpc SetPolicyRule      (policy.PolicyRule  ) returns (       policy.PolicyRuleId    ) {}
  rpc RemovePolicyRule   (policy.PolicyRuleId) returns (       context.Empty          ) {}
}
+94 −3
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
syntax = "proto3";
package context;

import "acl.proto";
import "kpi_sample_types.proto";

service ContextService {
@@ -305,11 +306,47 @@ message ConnectionId {
  Uuid connection_uuid = 1;
}

message ConnectionSettings_L0 {
  string lsp_symbolic_name = 1;
}

message ConnectionSettings_L2 {
  string src_mac_address = 1;
  string dst_mac_address = 2;
  uint32 ether_type = 3;
  uint32 vlan_id = 4;
  uint32 mpls_label = 5;
  uint32 mpls_traffic_class = 6;
}

message ConnectionSettings_L3 {
  string src_ip_address = 1;
  string dst_ip_address = 2;
  uint32 dscp = 3;
  uint32 protocol = 4;
  uint32 ttl = 5;
}

message ConnectionSettings_L4 {
  uint32 src_port = 1;
  uint32 dst_port = 2;
  uint32 tcp_flags = 3;
  uint32 ttl = 4;
}

message ConnectionSettings {
  ConnectionSettings_L0 l0 = 1;
  ConnectionSettings_L2 l2 = 2;
  ConnectionSettings_L3 l3 = 3;
  ConnectionSettings_L4 l4 = 4;
}

message Connection {
  ConnectionId connection_id = 1;
  ServiceId service_id = 2;
  repeated EndPointId path_hops_endpoint_ids = 3;
  repeated ServiceId sub_service_ids = 4;
  ConnectionSettings settings = 5;
}

message ConnectionIdList {
@@ -347,19 +384,73 @@ enum ConfigActionEnum {
  CONFIGACTION_DELETE = 2;
}

message ConfigRule_Custom {
  string resource_key = 1;
  string resource_value = 2;
}

message ConfigRule_ACL {
  EndPointId endpoint_id = 1;
  acl.AclRuleSet rule_set = 2;
}

message ConfigRule {
  ConfigActionEnum action = 1;
  string resource_key = 2;
  string resource_value = 3;
  oneof config_rule {
    ConfigRule_Custom custom = 2;
    ConfigRule_ACL acl = 3;
  }
}


// ----- Constraint ----------------------------------------------------------------------------------------------------
message Constraint {
message Constraint_Custom {
  string constraint_type = 1;
  string constraint_value = 2;
}

message Constraint_Schedule {
  float start_timestamp = 1;
  float duration_days = 2;
}

message GPS_Position {
  float latitude = 1;
  float longitude = 2;
}

message Constraint_EndPointLocation {
  EndPointId endpoint_id = 1;
  oneof location {
    string region = 2;
    GPS_Position gps_position = 3;
  }
}

message Constraint_SLA_Latency {
  float e2e_latency_ms = 1;
}

message Constraint_SLA_Capacity {
  float capacity_gbps = 1;
}

message Constraint_SLA_Availability {
  uint32 num_disjoint_paths = 1;
  bool all_active = 2;
}

message Constraint {
  oneof constraint {
    Constraint_Custom custom = 1;
    Constraint_Schedule schedule = 2;
    Constraint_EndPointLocation endpoint_location = 3;
    Constraint_SLA_Capacity sla_capacity = 4;
    Constraint_SLA_Latency sla_latency = 5;
    Constraint_SLA_Availability sla_availability = 6;
  }
}


// ----- Miscellaneous -------------------------------------------------------------------------------------------------
message TeraFlowController {
+5 −0
Original line number Diff line number Diff line
@@ -80,3 +80,8 @@ message PolicyRule {
message PolicyRuleList {
  repeated PolicyRule policyRuleList = 1;
}

// A list of policy rule Ids
message PolicyRuleIdList {
  repeated PolicyRuleId policyRuleIds = 1;
}
+11 −1
Original line number Diff line number Diff line
@@ -36,10 +36,20 @@ tee proto/__init__.py << EOF > /dev/null

EOF

python -m grpc_tools.protoc -I../../proto --python_out=proto --grpc_python_out=proto acl.proto
python -m grpc_tools.protoc -I../../proto --python_out=proto --grpc_python_out=proto context.proto
python -m grpc_tools.protoc -I../../proto --python_out=proto --grpc_python_out=proto context-policy.proto
python -m grpc_tools.protoc -I../../proto --python_out=proto --grpc_python_out=proto kpi_sample_types.proto
python -m grpc_tools.protoc -I../../proto --python_out=proto --grpc_python_out=proto policy.proto

rm proto/acl_pb2_grpc.py
rm proto/kpi_sample_types_pb2_grpc.py
rm proto/policy_pb2_grpc.py

sed -i -E 's/(import\ .*)_pb2/from . \1_pb2/g' proto/context_pb2.py
sed -i -E 's/(import\ .*)_pb2/from . \1_pb2/g' proto/acl_pb2.py
sed -i -E 's/(import\ .*)_pb2/from . \1_pb2/g' proto/context_pb2_grpc.py
sed -i -E 's/(import\ .*)_pb2/from . \1_pb2/g' proto/context_pb2.py
sed -i -E 's/(import\ .*)_pb2/from . \1_pb2/g' proto/context_policy_pb2_grpc.py
sed -i -E 's/(import\ .*)_pb2/from . \1_pb2/g' proto/context_policy_pb2.py
sed -i -E 's/(import\ .*)_pb2/from . \1_pb2/g' proto/kpi_sample_types_pb2.py
sed -i -E 's/(import\ .*)_pb2/from . \1_pb2/g' proto/policy_pb2.py
Loading