blob: 14dccb18146ee458e5f85f4cdb882527aa36f43f [file] [log] [blame]
Chip Bolingf5af85d2019-02-12 15:36:17 -06001# Copyright 2017-present Adtran, Inc.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15
16class GemPort(object):
17 """
18 Class to wrap TCont capabilities
19 """
20 def __init__(self, gem_id, alloc_id, uni_id, tech_profile_id,
21 encryption=False,
22 multicast=False,
23 traffic_class=None,
24 handler=None,
25 is_mock=False):
26
27 self.gem_id = gem_id
28 self._alloc_id = alloc_id
29 self.uni_id = uni_id
30 self.tech_profile_id = tech_profile_id
31 self.traffic_class = traffic_class
32 self._encryption = encryption
33 self.multicast = multicast
34 self._handler = handler
35 self._is_mock = is_mock
36 self.tech_profile_id = None # TODO: Make property and clean up object once tech profiles fully supported
37
38 # Statistics
39 self.rx_packets = 0
40 self.rx_bytes = 0
41 self.tx_packets = 0
42 self.tx_bytes = 0
43
44 def __str__(self):
45 return "GemPort: alloc-id: {}, gem-id: {}, uni-id: {}".format(self.alloc_id,
46 self.gem_id,
47 self.uni_id)
48
49 @property
50 def alloc_id(self):
51 return self._alloc_id
52
53 @property
54 def encryption(self):
55 return self._encryption
56
57 def to_dict(self):
58 return {
59 'port-id': self.gem_id,
60 'alloc-id': self.alloc_id,
61 'encryption': self._encryption,
62 'omci-transport': False
63 }