Coverage for nova/console/securityproxy/base.py: 80%

5 statements  

« prev     ^ index     » next       coverage.py v7.6.12, created at 2025-04-17 15:08 +0000

1# Copyright (c) 2014-2016 Red Hat, Inc 

2# All Rights Reserved. 

3# 

4# Licensed under the Apache License, Version 2.0 (the "License"); you may 

5# not use this file except in compliance with the License. You may obtain 

6# a copy of the License at 

7# 

8# http://www.apache.org/licenses/LICENSE-2.0 

9# 

10# Unless required by applicable law or agreed to in writing, software 

11# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 

12# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 

13# License for the specific language governing permissions and limitations 

14# under the License. 

15 

16import abc 

17 

18 

19class SecurityProxy(metaclass=abc.ABCMeta): 

20 """A console security Proxy Helper 

21 

22 Console security proxy helpers should subclass 

23 this class and implement a generic `connect` 

24 for the particular protocol being used. 

25 

26 Security drivers can then subclass the 

27 protocol-specific helper class. 

28 """ 

29 

30 @abc.abstractmethod 

31 def connect(self, tenant_sock, compute_sock): 

32 """Initiate the console connection 

33 

34 This method performs the protocol specific 

35 negotiation, and returns the socket-like 

36 object to use to communicate with the server 

37 securely. 

38 

39 :param tenant_sock: socket connected to the remote tenant user 

40 :param compute_sock: socket connected to the compute node instance 

41 

42 :returns: a new compute_sock for the instance 

43 """ 

44 pass