From e340a6077c649329f3a62fbd720d49f4d5b3d577 Mon Sep 17 00:00:00 2001 From: henry54809 Date: Mon, 18 Oct 2021 21:24:56 -0400 Subject: [PATCH] =?UTF-8?q?Use=20explicit=20manual=20sequester=20to=20avoi?= =?UTF-8?q?d=20auto=20sequestering=20under=20normal=E2=80=A6=20(#346)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Replace master with promary in comments * Use explicit manual sequester to avoid auto sequestering under normal operation. * Use safe_load instead of load * Fix yaml version Co-authored-by: Anurag Porripireddi --- forch/port_state_manager.py | 4 ++-- forch/proto/shared_constants_pb2.py | 24 ++++++++++++++---------- proto/shared_constants.proto | 3 +++ public/protos.hash | 2 +- public/protos.html | 6 ++++++ 5 files changed, 26 insertions(+), 13 deletions(-) diff --git a/forch/port_state_manager.py b/forch/port_state_manager.py index 4819fa70b..662c23063 100644 --- a/forch/port_state_manager.py +++ b/forch/port_state_manager.py @@ -52,7 +52,7 @@ class PortStateMachine: PortBehavior.Behavior: { PortBehavior.Behavior.cleared: OPERATIONAL, PortBehavior.Behavior.deauthenticated: UNAUTHENTICATED, - PortBehavior.Behavior.sequestered: SEQUESTERED + PortBehavior.Behavior.manual_sequestered: SEQUESTERED } }, } @@ -377,7 +377,7 @@ def _handle_scheduled_sequstering(self, mac): del self._scheduled_sequester_timer[mac] self._logger.info('Handle scheduled sequester for device %s.', mac) if mac in self._state_machines: - self._state_machines[mac].handle_port_behavior(PortBehavior.sequestered) + self._state_machines[mac].handle_port_behavior(PortBehavior.manual_sequestered) def _handle_sequestering_timeout(self, mac): if mac in self._sequester_timer: diff --git a/forch/proto/shared_constants_pb2.py b/forch/proto/shared_constants_pb2.py index 81434a1f4..869131af4 100644 --- a/forch/proto/shared_constants_pb2.py +++ b/forch/proto/shared_constants_pb2.py @@ -19,7 +19,7 @@ package='', syntax='proto3', serialized_options=None, - serialized_pb=_b('\n\"forch/proto/shared_constants.proto\"\x8d\x01\n\x05State\"\x83\x01\n\x05State\x12\x0b\n\x07unknown\x10\x00\x12\n\n\x06\x62roken\x10\x01\x12\n\n\x06\x61\x63tive\x10\x02\x12\x0b\n\x07\x64\x61maged\x10\x03\x12\x08\n\x04\x64own\x10\x04\x12\x0b\n\x07healthy\x10\x05\x12\x0c\n\x08inactive\x10\x06\x12\x10\n\x0cinitializing\x10\x07\x12\t\n\x05split\x10\x08\x12\x06\n\x02up\x10\t\"Y\n\tLacpState\"L\n\tLacpState\x12\x0b\n\x07\x64\x65\x66\x61ult\x10\x00\x12\x11\n\x04none\x10\xff\xff\xff\xff\xff\xff\xff\xff\xff\x01\x12\x08\n\x04init\x10\x01\x12\n\n\x06\x61\x63tive\x10\x03\x12\t\n\x05noact\x10\x05\"\x98\x01\n\x08\x44VAState\"\x8b\x01\n\x05State\x12\x0b\n\x07initial\x10\x00\x12\x13\n\x0funauthenticated\x10\x01\x12\x0f\n\x0bsequestered\x10\x02\x12\x16\n\x12static_operational\x10\x03\x12\x17\n\x13\x64ynamic_operational\x10\x04\x12\r\n\tinfracted\x10\x05\x12\x0f\n\x0boperational\x10\x06\"L\n\x08\x41uthMode\"@\n\x04Mode\x12\x0c\n\x08\x64isabled\x10\x00\x12\x0f\n\x0bstatic_only\x10\x01\x12\x10\n\x0c\x64ynamic_only\x10\x02\x12\x07\n\x03\x61ll\x10\x03\"a\n\x08LacpRole\"U\n\x08LacpRole\x12\x0b\n\x07\x64\x65\x66\x61ult\x10\x00\x12\x11\n\x04none\x10\xff\xff\xff\xff\xff\xff\xff\xff\xff\x01\x12\x0e\n\nunselected\x10\x01\x12\x0c\n\x08selected\x10\x02\x12\x0b\n\x07standby\x10\x03\"C\n\x08PortType\"7\n\x04Type\x12\x0b\n\x07unknown\x10\x00\x12\n\n\x06\x61\x63\x63\x65ss\x10\x01\x12\x0b\n\x07testing\x10\x02\x12\t\n\x05other\x10\x03\"W\n\nTestResult\"I\n\nResultCode\x12\x0b\n\x07PENDING\x10\x00\x12\x0b\n\x07STARTED\x10\x01\x12\t\n\x05\x45RROR\x10\x02\x12\n\n\x06PASSED\x10\x03\x12\n\n\x06\x46\x41ILED\x10\x04\"\xe0\x01\n\x0cPortBehavior\"u\n\x08\x42\x65havior\x12\x0b\n\x07unknown\x10\x00\x12\x11\n\rauthenticated\x10\x01\x12\x0b\n\x07\x63leared\x10\x02\x12\x0f\n\x0bsequestered\x10\x03\x12\n\n\x06passed\x10\x04\x12\n\n\x06\x66\x61iled\x10\x05\x12\x13\n\x0f\x64\x65\x61uthenticated\x10\x06\"\x1d\n\tPortState\x12\x08\n\x04\x64own\x10\x00\x12\x06\n\x02up\x10\x01\":\n\x10\x41utoSequestering\x12\x0b\n\x07\x64\x65\x66\x61ult\x10\x00\x12\x0b\n\x07\x65nabled\x10\x01\x12\x0c\n\x08\x64isabled\x10\x02\"\x07\n\x05\x45mptyb\x06proto3') + serialized_pb=_b('\n\"forch/proto/shared_constants.proto\"\x8d\x01\n\x05State\"\x83\x01\n\x05State\x12\x0b\n\x07unknown\x10\x00\x12\n\n\x06\x62roken\x10\x01\x12\n\n\x06\x61\x63tive\x10\x02\x12\x0b\n\x07\x64\x61maged\x10\x03\x12\x08\n\x04\x64own\x10\x04\x12\x0b\n\x07healthy\x10\x05\x12\x0c\n\x08inactive\x10\x06\x12\x10\n\x0cinitializing\x10\x07\x12\t\n\x05split\x10\x08\x12\x06\n\x02up\x10\t\"Y\n\tLacpState\"L\n\tLacpState\x12\x0b\n\x07\x64\x65\x66\x61ult\x10\x00\x12\x11\n\x04none\x10\xff\xff\xff\xff\xff\xff\xff\xff\xff\x01\x12\x08\n\x04init\x10\x01\x12\n\n\x06\x61\x63tive\x10\x03\x12\t\n\x05noact\x10\x05\"\x98\x01\n\x08\x44VAState\"\x8b\x01\n\x05State\x12\x0b\n\x07initial\x10\x00\x12\x13\n\x0funauthenticated\x10\x01\x12\x0f\n\x0bsequestered\x10\x02\x12\x16\n\x12static_operational\x10\x03\x12\x17\n\x13\x64ynamic_operational\x10\x04\x12\r\n\tinfracted\x10\x05\x12\x0f\n\x0boperational\x10\x06\"L\n\x08\x41uthMode\"@\n\x04Mode\x12\x0c\n\x08\x64isabled\x10\x00\x12\x0f\n\x0bstatic_only\x10\x01\x12\x10\n\x0c\x64ynamic_only\x10\x02\x12\x07\n\x03\x61ll\x10\x03\"a\n\x08LacpRole\"U\n\x08LacpRole\x12\x0b\n\x07\x64\x65\x66\x61ult\x10\x00\x12\x11\n\x04none\x10\xff\xff\xff\xff\xff\xff\xff\xff\xff\x01\x12\x0e\n\nunselected\x10\x01\x12\x0c\n\x08selected\x10\x02\x12\x0b\n\x07standby\x10\x03\"C\n\x08PortType\"7\n\x04Type\x12\x0b\n\x07unknown\x10\x00\x12\n\n\x06\x61\x63\x63\x65ss\x10\x01\x12\x0b\n\x07testing\x10\x02\x12\t\n\x05other\x10\x03\"W\n\nTestResult\"I\n\nResultCode\x12\x0b\n\x07PENDING\x10\x00\x12\x0b\n\x07STARTED\x10\x01\x12\t\n\x05\x45RROR\x10\x02\x12\n\n\x06PASSED\x10\x03\x12\n\n\x06\x46\x41ILED\x10\x04\"\xf9\x01\n\x0cPortBehavior\"\x8d\x01\n\x08\x42\x65havior\x12\x0b\n\x07unknown\x10\x00\x12\x11\n\rauthenticated\x10\x01\x12\x0b\n\x07\x63leared\x10\x02\x12\x0f\n\x0bsequestered\x10\x03\x12\n\n\x06passed\x10\x04\x12\n\n\x06\x66\x61iled\x10\x05\x12\x13\n\x0f\x64\x65\x61uthenticated\x10\x06\x12\x16\n\x12manual_sequestered\x10\x07\"\x1d\n\tPortState\x12\x08\n\x04\x64own\x10\x00\x12\x06\n\x02up\x10\x01\":\n\x10\x41utoSequestering\x12\x0b\n\x07\x64\x65\x66\x61ult\x10\x00\x12\x0b\n\x07\x65nabled\x10\x01\x12\x0c\n\x08\x64isabled\x10\x02\"\x07\n\x05\x45mptyb\x06proto3') ) @@ -316,11 +316,15 @@ name='deauthenticated', index=6, number=6, serialized_options=None, type=None), + _descriptor.EnumValueDescriptor( + name='manual_sequestered', index=7, number=7, + serialized_options=None, + type=None), ], containing_type=None, serialized_options=None, - serialized_start=780, - serialized_end=897, + serialized_start=781, + serialized_end=922, ) _sym_db.RegisterEnumDescriptor(_PORTBEHAVIOR_BEHAVIOR) @@ -341,8 +345,8 @@ ], containing_type=None, serialized_options=None, - serialized_start=899, - serialized_end=928, + serialized_start=924, + serialized_end=953, ) _sym_db.RegisterEnumDescriptor(_PORTBEHAVIOR_PORTSTATE) @@ -367,8 +371,8 @@ ], containing_type=None, serialized_options=None, - serialized_start=930, - serialized_end=988, + serialized_start=955, + serialized_end=1013, ) _sym_db.RegisterEnumDescriptor(_PORTBEHAVIOR_AUTOSEQUESTERING) @@ -571,7 +575,7 @@ oneofs=[ ], serialized_start=764, - serialized_end=988, + serialized_end=1013, ) @@ -594,8 +598,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=990, - serialized_end=997, + serialized_start=1015, + serialized_end=1022, ) _STATE_STATE.containing_type = _STATE diff --git a/proto/shared_constants.proto b/proto/shared_constants.proto index c83a8daee..f80a958e4 100644 --- a/proto/shared_constants.proto +++ b/proto/shared_constants.proto @@ -201,6 +201,9 @@ message PortBehavior { // deauthenticated deauthenticated = 6; + + // Manual sequestered + manual_sequestered = 7; } enum PortState { diff --git a/public/protos.hash b/public/protos.hash index 4a1217169..abb99d021 100644 --- a/public/protos.hash +++ b/public/protos.hash @@ -13,6 +13,6 @@ de40904bfd80b5063478058caecc1ffa0ee6ebe3 proto/forch_configuration.proto 83e8f50c6a8b53bc2c65d98c5b0f2fe45ad6adbc proto/network_metric_state.proto db4d1bf4d1b4ac1a575853833ecbd9571d784203 proto/path_node.proto 255a8c039f0487faa2632df22efff854285c6297 proto/process_state.proto -36ab66f7c688822694a9abb0fb1588e6f5bd0f3f proto/shared_constants.proto +0f632f51f6e314c991b0738f5d51ab1c24994d92 proto/shared_constants.proto f2907589bfb18d4b1622b9d658899c11b56d3b86 proto/switch_state.proto 989e22bfd0863f9171eebc728658c6926ce420ef proto/system_state.proto diff --git a/public/protos.html b/public/protos.html index e49fd7759..94ea1cd59 100644 --- a/public/protos.html +++ b/public/protos.html @@ -5988,6 +5988,12 @@

PortBehavior.Behavior

deauthenticated

+ + manual_sequestered + 7 +

Manual sequestered

+ +