@@ -1516,6 +1516,15 @@ def _extract_nos_version(self, data) -> None:
15161516class CumulusNode (Node ):
15171517 '''Cumulus Node specific implementation'''
15181518
1519+ async def _rest_connect (self ):
1520+ raise NotImplementedError (
1521+ f'{ self .address } : REST transport is not supported' )
1522+
1523+ async def _rest_gather (self , service_callback , cmd_list , cb_token ,
1524+ oformat = "json" , timeout = None , reconnect = True ):
1525+ raise NotImplementedError (
1526+ f'{ self .address } : REST transport is not supported' )
1527+
15191528 async def _fetch_init_dev_data_devtype (self , reconnect : bool ):
15201529 """Fill in the boot time of the node by executing certain cmds"""
15211530 await self ._exec_cmd (self ._parse_init_dev_data ,
@@ -1555,76 +1564,18 @@ def _extract_nos_version(self, data: str) -> None:
15551564 self .logger .error (
15561565 f'Cannot parse version from { self .address } :{ self .port } ' )
15571566
1558- async def _rest_connect (self ):
1559- '''Check that connectivity exists and works'''
15601567
1561- auth = aiohttp .BasicAuth (self .username , password = self .password )
1562- url = "https://{0}:{1}/nclu/v1/rpc" .format (self .address , self .port )
1563- headers = {"Content-Type" : "application/json" }
1568+ class LinuxNode (CumulusNode ):
1569+ '''Linux server node'''
15641570
1565- async with self ._cmd_pacer .wait (self .per_cmd_auth ):
1566- try :
1567- self ._conn = aiohttp .ClientSession (
1568- auth = auth , timeout = self .cmd_timeout ,
1569- connector = aiohttp .TCPConnector (ssl = False )
1570- )
1571- async with self ._conn .post (url , headers = headers ) as response :
1572- _ = response .status
1573- except Exception as e :
1574- self .current_exception = e
1575- self .logger .error (
1576- f"{ self .transport } ://{ self .hostname } :{ self .port } : Unable "
1577- f"to communicate with node due to { str (e )} " )
1571+ async def _rest_connect (self ):
1572+ raise NotImplementedError (
1573+ f'{ self .address } : REST transport is not supported' )
15781574
15791575 async def _rest_gather (self , service_callback , cmd_list , cb_token ,
1580- oformat = 'json' , timeout = None , reconnect = True ):
1581-
1582- result = []
1583- if not cmd_list :
1584- return result
1585-
1586- if not self .is_connected or self ._is_connecting :
1587- if reconnect :
1588- await self ._init_rest ()
1589- if not self .is_connected :
1590- self .logger .error (
1591- f'Unable to connect to node { self .address } :{ self .port } '
1592- f'. While executing: { cmd_list } ' )
1593- for cmd in cmd_list :
1594- result .append (self ._create_error (cmd ))
1595- await self ._post_result (service_callback , result , cb_token )
1596- return
1597-
1598- url = "https://{0}:{1}/nclu/v1/rpc" .format (self .address , self .port )
1599- headers = {"Content-Type" : "application/json" }
1600-
1601- async with self ._cmd_pacer .wait (self .per_cmd_auth ):
1602- try :
1603- for cmd in cmd_list :
1604- data = {"cmd" : cmd }
1605- cmd_timestamp = time .time ()
1606- self .logger .info (f'{ self .address } :{ self .port } exec: { cmd } ' )
1607- async with self ._conn .post (
1608- url , json = data , headers = headers
1609- ) as response :
1610- data_res = await response .text ()
1611- result .append (
1612- self ._create_result (
1613- cmd , response .status , data_res ,
1614- cmd_timestamp )
1615- )
1616- except Exception as e :
1617- self .current_exception = e
1618- result .append (self ._create_error (cmd_list ))
1619- self .logger .error (
1620- f"{ self .transport } ://{ self .hostname } :{ self .port } : Unable "
1621- f"to communicate with node due to { str (e )} " )
1622-
1623- await self ._post_result (service_callback , result , cb_token )
1624-
1625-
1626- class LinuxNode (CumulusNode ):
1627- '''Linux server node'''
1576+ oformat = "json" , timeout = None , reconnect = True ):
1577+ raise NotImplementedError (
1578+ f'{ self .address } : REST transport is not supported' )
16281579
16291580
16301581class IosXRNode (Node ):
0 commit comments