atlanticwave-sdx / sdx-controller

Central Controller for AtlanticWave SDX.
https://www.atlanticwave-sdx.net
MIT License
1 stars 3 forks source link

Missing rabbitmq auth in rpc_queue_consumer #253

Closed italovalcy closed 3 months ago

italovalcy commented 3 months ago

Hi,

This is related to #223 and #250 . We forgot to add the auth methods for one of the calls there.

https://github.com/atlanticwave-sdx/sdx-controller/blob/main/sdx_controller/messaging/rpc_queue_consumer.py#L50-L52

After running the full integration test, it results in:

sdx-controller  | DEBUG:sdx_controller.utils.db_utils:DB sdx_lc initialized
sdx-controller  | INFO:     Started server process [1]
sdx-controller  | INFO:     Waiting for application startup.
sdx-controller  | INFO:     ASGI 'lifespan' protocol appears unsupported.
sdx-controller  | INFO:     Application startup complete.
sdx-controller  | INFO:     Uvicorn running on http://0.0.0.0:8080 (Press CTRL+C to quit)
sdx-controller  | INFO:sdx_controller.messaging.rpc_queue_consumer: [MQ] Awaiting requests from queue: topo
sdx-controller  | INFO:sdx_datamodel.parsing.porthandler:Found l2vpn_ptp_vlan_range: [[1, 100]], l2vpn_ptmp_vlan_range: [[1, 100]] in port 'urn:sdx:port:ampath.net:Ampath3:50'
sdx-controller  | INFO:sdx_datamodel.parsing.porthandler:Found l2vpn_ptp_vlan_range: [[1, 100]], l2vpn_ptmp_vlan_range: [[1, 100]] in port 'urn:sdx:port:ampath.net:Ampath3:2'
sdx-controller  | INFO:sdx_datamodel.parsing.porthandler:Found l2vpn_ptp_vlan_range: [[1, 100]], l2vpn_ptmp_vlan_range: [[1, 100]] in port 'urn:sdx:port:ampath.net:Ampath3:3'
sdx-controller  | INFO:sdx_datamodel.parsing.porthandler:Found l2vpn_ptp_vlan_range: [[1, 100]], l2vpn_ptmp_vlan_range: [[1, 100]] in port 'urn:sdx:port:ampath.net:Ampath2:1'
sdx-controller  | INFO:sdx_datamodel.parsing.porthandler:Found l2vpn_ptp_vlan_range: [[1, 100]], l2vpn_ptmp_vlan_range: [[1, 100]] in port 'urn:sdx:port:ampath.net:Ampath2:50'
sdx-controller  | INFO:sdx_datamodel.parsing.porthandler:Found l2vpn_ptp_vlan_range: [[1, 100]], l2vpn_ptmp_vlan_range: [[1, 100]] in port 'urn:sdx:port:ampath.net:Ampath2:40'
sdx-controller  | INFO:sdx_datamodel.parsing.porthandler:Found l2vpn_ptp_vlan_range: [[1, 100]], l2vpn_ptmp_vlan_range: [[1, 100]] in port 'urn:sdx:port:ampath.net:Ampath2:3'
sdx-controller  | INFO:sdx_datamodel.parsing.porthandler:Found l2vpn_ptp_vlan_range: [[1, 100]], l2vpn_ptmp_vlan_range: [[1, 100]] in port 'urn:sdx:port:ampath.net:Ampath1:1'
sdx-controller  | INFO:sdx_datamodel.parsing.porthandler:Found l2vpn_ptp_vlan_range: [[1, 100]], l2vpn_ptmp_vlan_range: [[1, 100]] in port 'urn:sdx:port:ampath.net:Ampath1:40'
sdx-controller  | INFO:sdx_datamodel.parsing.porthandler:Found l2vpn_ptp_vlan_range: [[1, 100]], l2vpn_ptmp_vlan_range: [[1, 100]] in port 'urn:sdx:port:ampath.net:Ampath1:50'
sdx-controller  | INFO:sdx_datamodel.parsing.porthandler:Found l2vpn_ptp_vlan_range: [[1, 100]], l2vpn_ptmp_vlan_range: [[1, 100]] in port 'urn:sdx:port:ampath.net:Ampath1:2'
sdx-controller  | INFO:sdx_controller.messaging.rpc_queue_consumer:Saving to database.
sdx-controller  | INFO:sdx_controller.handlers.lc_message_handler:MQ received message:b'{"id": "urn:sdx:topology:ampath.net", "name": "Ampath-OXP", "version": 1, "model_version": "1.0.0", "timestamp": "2024-04-10T16:58:33Z", "nodes": [{"name": "Ampath3", "id": "urn:sdx:node:ampath.net:Ampath3", "location": {"address": "Jacksonville", "latitude": 30.27, "longitude": -81.68, "iso3166_2_lvl4": "US-FL"}, "ports": [{"id": "urn:sdx:port:ampath.net:Ampath3:50", "name": "Ampath3-eth50", "node": "urn:sdx:node:ampath.net:Ampath3", "type": "10GE", "status": "up", "state": "enabled", "mtu": 1500, "short_name": "Ampath3-eth50", "services": {"l2vpn-ptp": {"vlan_range": [[1, 100]]}, "l2vpn-ptmp": {"vlan_range": [[1, 100]]}}, "label_range": ["1-100"]}, {"id": "urn:sdx:port:ampath.net:Ampath3:2", "name": "Ampath3-eth2", "node": "urn:sdx:node:ampath.net:Ampath3", "type": "10GE", "status": "up", "state": "enabled", "mtu": 1500, "short_name": "Ampath3-eth2", "services": {"l2vpn-ptp": {"vlan_range": [[1, 100]]}, "l2vpn-ptmp": {"vlan_range": [[1, 100]]}}, "label_range": ["1-100"]}, {"id": "urn:sdx:port:ampath.net:Ampath3:3", "name": "Ampath3-eth3", "node": "urn:sdx:node:ampath.net:Ampath3", "type": "10GE", "status": "up", "state": "enabled", "mtu": 1500, "short_name": "Ampath3-eth3", "services": {"l2vpn-ptp": {"vlan_range": [[1, 100]]}, "l2vpn-ptmp": {"vlan_range": [[1, 100]]}}, "label_range": ["1-100"]}]}, {"name": "Ampath2", "id": "urn:sdx:node:ampath.net:Ampath2", "location": {"address": "BocaRaton", "latitude": 26.38, "longitude": -80.11, "iso3166_2_lvl4": "US-FL"}, "ports": [{"id": "urn:sdx:port:ampath.net:Ampath2:1", "name": "Ampath2-eth1", "node": "urn:sdx:node:ampath.net:Ampath2", "type": "10GE", "status": "up", "state": "enabled", "mtu": 1500, "short_name": "Ampath2-eth1", "services": {"l2vpn-ptp": {"vlan_range": [[1, 100]]}, "l2vpn-ptmp": {"vlan_range": [[1, 100]]}}, "label_range": ["1-100"]}, {"id": "urn:sdx:port:ampath.net:Ampath2:50", "name": "Ampath2-eth50", "node": "urn:sdx:node:ampath.net:Ampath2", "type": "10GE", "status": "up", "state": "enabled", "mtu": 1500, "short_name": "Ampath2-eth50", "services": {"l2vpn-ptp": {"vlan_range": [[1, 100]]}, "l2vpn-ptmp": {"vlan_range": [[1, 100]]}}, "label_range": ["1-100"]}, {"id": "urn:sdx:port:ampath.net:Ampath2:40", "name": "Ampath2-eth40", "node": "urn:sdx:node:ampath.net:Ampath2", "type": "10GE", "status": "up", "state": "enabled", "mtu": 1500, "short_name": "Ampath2-eth40", "nni": "urn:sdx:link:sax.net:Sax02:40", "services": {"l2vpn-ptp": {"vlan_range": [[1, 100]]}, "l2vpn-ptmp": {"vlan_range": [[1, 100]]}}, "label_range": ["1-100"]}, {"id": "urn:sdx:port:ampath.net:Ampath2:3", "name": "Ampath2-eth3", "node": "urn:sdx:node:ampath.net:Ampath2", "type": "10GE", "status": "up", "state": "enabled", "mtu": 1500, "short_name": "Ampath2-eth3", "services": {"l2vpn-ptp": {"vlan_range": [[1, 100]]}, "l2vpn-ptmp": {"vlan_range": [[1, 100]]}}, "label_range": ["1-100"]}]}, {"name": "Ampath1", "id": "urn:sdx:node:ampath.net:Ampath1", "location": {"address": "Miami", "latitude": 25.77, "longitude": -80.19, "iso3166_2_lvl4": "US-FL"}, "ports": [{"id": "urn:sdx:port:ampath.net:Ampath1:1", "name": "Ampath1-eth1", "node": "urn:sdx:node:ampath.net:Ampath1", "type": "10GE", "status": "up", "state": "enabled", "mtu": 1500, "short_name": "Ampath1-eth1", "services": {"l2vpn-ptp": {"vlan_range": [[1, 100]]}, "l2vpn-ptmp": {"vlan_range": [[1, 100]]}}, "label_range": ["1-100"]}, {"id": "urn:sdx:port:ampath.net:Ampath1:40", "name": "Ampath1-eth40", "node": "urn:sdx:node:ampath.net:Ampath1", "type": "10GE", "status": "up", "state": "enabled", "mtu": 1500, "short_name": "Ampath1-eth40", "nni": "urn:sdx:link:sax.net:Sax01:40", "services": {"l2vpn-ptp": {"vlan_range": [[1, 100]]}, "l2vpn-ptmp": {"vlan_range": [[1, 100]]}}, "label_range": ["1-100"]}, {"id": "urn:sdx:port:ampath.net:Ampath1:50", "name": "Ampath1-eth50", "node": "urn:sdx:node:ampath.net:Ampath1", "type": "10GE", "status": "up", "state": "enabled", "mtu": 1500, "short_name": "Ampath1-eth50", "services": {"l2vpn-ptp": {"vlan_range": [[1, 100]]}, "l2vpn-ptmp": {"vlan_range": [[1, 100]]}}, "label_range": ["1-100"]}, {"id": "urn:sdx:port:ampath.net:Ampath1:2", "name": "Ampath1-eth2", "node": "urn:sdx:node:ampath.net:Ampath1", "type": "10GE", "status": "up", "state": "enabled", "mtu": 1500, "short_name": "Ampath1-eth2", "services": {"l2vpn-ptp": {"vlan_range": [[1, 100]]}, "l2vpn-ptmp": {"vlan_range": [[1, 100]]}}, "label_range": ["1-100"]}]}], "links": [{"name": "Ampath3/2_Ampath1/2", "id": "urn:sdx:link:ampath.net:Ampath3/2_Ampath1/2", "ports": [{"id": "urn:sdx:port:ampath.net:Ampath3:2", "name": "Ampath3-eth2", "node": "urn:sdx:node:ampath.net:Ampath3", "type": "Other", "status": "up", "state": "disabled", "services": {"l2vpn-ptp": {"vlan_range": [[1, 4096]]}, "l2vpn-ptmp": {"vlan_range": [[1, 4096]]}}, "label_range": ["1-100"], "nni": "sdx_nni:", "mtu": 0}, {"id": "urn:sdx:port:ampath.net:Ampath1:2", "name": "Ampath1-eth2", "node": "urn:sdx:node:ampath.net:Ampath1", "type": "Other", "status": "up", "state": "disabled", "services": {"l2vpn-ptp": {"vlan_range": [[1, 4096]]}, "l2vpn-ptmp": {"vlan_range": [[1, 4096]]}}, "label_range": ["1-100"], "nni": "sdx_nni:", "mtu": 0}], "type": "intra", "bandwidth": 12500, "residual_bandwidth": 100, "latency": 2, "packet_loss": 2, "availability": 100, "status": "up", "state": "enabled"}, {"name": "Ampath2/1_Ampath1/1", "id": "urn:sdx:link:ampath.net:Ampath2/1_Ampath1/1", "ports": [{"id": "urn:sdx:port:ampath.net:Ampath2:1", "name": "Ampath2-eth1", "node": "urn:sdx:node:ampath.net:Ampath2", "type": "Other", "status": "up", "state": "disabled", "services": {"l2vpn-ptp": {"vlan_range": [[1, 4096]]}, "l2vpn-ptmp": {"vlan_range": [[1, 4096]]}}, "label_range": ["1-100"], "nni": "sdx_nni:", "mtu": 0}, {"id": "urn:sdx:port:ampath.net:Ampath1:1", "name": "Ampath1-eth1", "node": "urn:sdx:node:ampath.net:Ampath1", "type": "Other", "status": "up", "state": "disabled", "services": {"l2vpn-ptp": {"vlan_range": [[1, 4096]]}, "l2vpn-ptmp": {"vlan_range": [[1, 4096]]}}, "label_range": ["1-100"], "nni": "sdx_nni:", "mtu": 0}], "type": "intra", "bandwidth": 12500, "residual_bandwidth": 100, "latency": 2, "packet_loss": 2, "availability": 100, "status": "up", "state": "enabled"}, {"name": "Ampath3/3_Ampath2/3", "id": "urn:sdx:link:ampath.net:Ampath3/3_Ampath2/3", "ports": [{"id": "urn:sdx:port:ampath.net:Ampath3:3", "name": "Ampath3-eth3", "node": "urn:sdx:node:ampath.net:Ampath3", "type": "Other", "status": "up", "state": "disabled", "services": {"l2vpn-ptp": {"vlan_range": [[1, 4096]]}, "l2vpn-ptmp": {"vlan_range": [[1, 4096]]}}, "label_range": ["1-100"], "nni": "sdx_nni:", "mtu": 0}, {"id": "urn:sdx:port:ampath.net:Ampath2:3", "name": "Ampath2-eth3", "node": "urn:sdx:node:ampath.net:Ampath2", "type": "Other", "status": "up", "state": "disabled", "services": {"l2vpn-ptp": {"vlan_range": [[1, 4096]]}, "l2vpn-ptmp": {"vlan_range": [[1, 4096]]}}, "label_range": ["1-100"], "nni": "sdx_nni:", "mtu": 0}], "type": "intra", "bandwidth": 12500, "residual_bandwidth": 100, "latency": 2, "packet_loss": 2, "availability": 100, "status": "up", "state": "enabled"}, {"name": "nni:ampath.net-sax.net", "id": "urn:sdx:link:nni:ampath.net-sax.net", "ports": [{"id": "urn:sdx:port:ampath.net:Ampath2:40", "name": "Ampath2-eth40", "node": "urn:sdx:node:ampath.net:Ampath2", "type": "Other", "status": "up", "state": "disabled", "label_range": ["1-100"]}, {"id": "urn:sdx:port:sax.net:Sax02:40", "name": "Sax02:40", "node": "urn:sdx:node:sax.net:Sax02", "type": "Other", "status": "up", "state": "disabled", "label_range": ["1-100"]}], "type": "inter", "bandwidth": 12500, "status": "up", "state": "enabled", "availability": 100, "residual_bandwidth": 100, "packet_loss": 0, "latency": 2}, {"name": "nni:ampath.net-sax.net", "id": "urn:sdx:link:nni:ampath.net-sax.net", "ports": [{"id": "urn:sdx:port:ampath.net:Ampath1:40", "name": "Ampath1-eth40", "node": "urn:sdx:node:ampath.net:Ampath1", "type": "Other", "status": "up", "state": "disabled", "label_range": ["1-100"]}, {"id": "urn:sdx:port:sax.net:Sax01:40", "name": "Sax01:40", "node": "urn:sdx:node:sax.net:Sax01", "type": "Other", "status": "up", "state": "disabled", "label_range": ["1-100"]}], "type": "inter", "bandwidth": 12500, "status": "up", "state": "enabled", "availability": 100, "residual_bandwidth": 100, "packet_loss": 0, "latency": 2}], "lc_queue_name": "ampath.net"}'
sdx-controller  | ERROR:pika.connection:Connection closed while authenticating indicating a probable authentication error
sdx-controller  | ERROR:pika.adapters.utils.connection_workflow:AMQPConnector - reporting failure: AMQPConnectorAMQPHandshakeError: ProbableAuthenticationError: Client was disconnected at a connection stage indicating a probable authentication error: ("ConnectionClosedByBroker: (403) 'ACCESS_REFUSED - Login was refused using authentication mechanism PLAIN. For details see the broker logfile.'",)
sdx-controller  | ERROR:pika.adapters.utils.connection_workflow:AMQP connection workflow failed: AMQPConnectionWorkflowFailed: 1 exceptions in all; last exception - AMQPConnectorAMQPHandshakeError: ProbableAuthenticationError: Client was disconnected at a connection stage indicating a probable authentication error: ("ConnectionClosedByBroker: (403) 'ACCESS_REFUSED - Login was refused using authentication mechanism PLAIN. For details see the broker logfile.'",); first exception - None.
sdx-controller  | ERROR:pika.adapters.utils.connection_workflow:AMQPConnectionWorkflow - reporting failure: AMQPConnectionWorkflowFailed: 1 exceptions in all; last exception - AMQPConnectorAMQPHandshakeError: ProbableAuthenticationError: Client was disconnected at a connection stage indicating a probable authentication error: ("ConnectionClosedByBroker: (403) 'ACCESS_REFUSED - Login was refused using authentication mechanism PLAIN. For details see the broker logfile.'",); first exception - None
sdx-controller  | ERROR:pika.adapters.blocking_connection:Connection workflow failed: AMQPConnectionWorkflowFailed: 1 exceptions in all; last exception - AMQPConnectorAMQPHandshakeError: ProbableAuthenticationError: Client was disconnected at a connection stage indicating a probable authentication error: ("ConnectionClosedByBroker: (403) 'ACCESS_REFUSED - Login was refused using authentication mechanism PLAIN. For details see the broker logfile.'",); first exception - None
sdx-controller  | ERROR:pika.adapters.blocking_connection:Error in _create_connection().
sdx-controller  | Traceback (most recent call last):
sdx-controller  |   File "/usr/local/lib/python3.9/site-packages/pika/adapters/blocking_connection.py", line 451, in _create_connection
sdx-controller  |     raise self._reap_last_connection_workflow_error(error)
sdx-controller  | pika.exceptions.ProbableAuthenticationError: ConnectionClosedByBroker: (403) 'ACCESS_REFUSED - Login was refused using authentication mechanism PLAIN. For details see the broker logfile.'
sdx-controller  | Exception in thread Thread-4:
sdx-controller  | Traceback (most recent call last):
sdx-controller  |   File "/usr/local/lib/python3.9/threading.py", line 980, in _bootstrap_inner
sdx-controller  |     self.run()
sdx-controller  |   File "/usr/local/lib/python3.9/threading.py", line 917, in run
sdx-controller  |     self._target(*self._args, **self._kwargs)
sdx-controller  |   File "/usr/src/app/sdx_controller/messaging/rpc_queue_consumer.py", line 68, in start_consumer
sdx-controller  |     self.channel.start_consuming()
sdx-controller  |   File "/usr/local/lib/python3.9/site-packages/pika/adapters/blocking_connection.py", line 1883, in start_consuming
sdx-controller  |     self._process_data_events(time_limit=None)
sdx-controller  |   File "/usr/local/lib/python3.9/site-packages/pika/adapters/blocking_connection.py", line 2044, in _process_data_events
sdx-controller  |     self.connection.process_data_events(time_limit=time_limit)
sdx-controller  |   File "/usr/local/lib/python3.9/site-packages/pika/adapters/blocking_connection.py", line 851, in process_data_events
sdx-controller  |     self._dispatch_channel_events()
sdx-controller  |   File "/usr/local/lib/python3.9/site-packages/pika/adapters/blocking_connection.py", line 567, in _dispatch_channel_events
sdx-controller  |     impl_channel._get_cookie()._dispatch_events()
sdx-controller  |   File "/usr/local/lib/python3.9/site-packages/pika/adapters/blocking_connection.py", line 1510, in _dispatch_events
sdx-controller  |     consumer_info.on_message_callback(self, evt.method,
sdx-controller  |   File "/usr/src/app/sdx_controller/messaging/rpc_queue_consumer.py", line 50, in on_request
sdx-controller  |     self.connection = pika.BlockingConnection(
sdx-controller  |   File "/usr/local/lib/python3.9/site-packages/pika/adapters/blocking_connection.py", line 360, in __init__
sdx-controller  |     self._impl = self._create_connection(parameters, _impl_class)
sdx-controller  |   File "/usr/local/lib/python3.9/site-packages/pika/adapters/blocking_connection.py", line 451, in _create_connection
sdx-controller  |     raise self._reap_last_connection_workflow_error(error)
sdx-controller  | pika.exceptions.ProbableAuthenticationError: ConnectionClosedByBroker: (403) 'ACCESS_REFUSED - Login was refused using authentication mechanism PLAIN. For details see the broker logfile.'