1 # Copyright 2016-2017 Intel Corporation.
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
7 # http://www.apache.org/licenses/LICENSE-2.0
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 """Abstract "packet forwarding" model.
16 This is an abstract class for packet forwarders.
19 class IPktFwd(object):
20 """Interface class that is implemented by specific classes
25 """Start the packet forwarder.
27 Provide a context manager interface to the packet forwarders.
28 This simply calls the :func:`start` function.
32 def __exit__(self, type_, value, traceback):
33 """Stop the packet forwarder.
35 Provide a context manager interface to the packet forwarders.
36 This simply calls the :func:`stop` function.
41 """Start the packet forwarder.
45 raise NotImplementedError('Please call an implementation.')
47 def start_for_guest(self):
48 """Start the packet forward for guest config
54 """Stop the packet forwarder.
58 raise NotImplementedError('Please call an implementation.')