Ashlesh Gawande | f5f304b | 2016-06-16 16:42:41 -0500 | [diff] [blame] | 1 | # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ |
| 2 | # |
| 3 | # Copyright (C) 2015-2017, The University of Memphis, |
| 4 | # Arizona Board of Regents, |
| 5 | # Regents of the University of California. |
| 6 | # |
| 7 | # This file is part of Mini-NDN. |
| 8 | # See AUTHORS.md for a complete list of Mini-NDN authors and contributors. |
| 9 | # |
| 10 | # Mini-NDN is free software: you can redistribute it and/or modify |
| 11 | # it under the terms of the GNU General Public License as published by |
| 12 | # the Free Software Foundation, either version 3 of the License, or |
| 13 | # (at your option) any later version. |
| 14 | # |
| 15 | # Mini-NDN is distributed in the hope that it will be useful, |
| 16 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 | # GNU General Public License for more details. |
| 19 | # |
| 20 | # You should have received a copy of the GNU General Public License |
| 21 | # along with Mini-NDN, e.g., in COPYING.md file. |
| 22 | # If not, see <http://www.gnu.org/licenses/>. |
| 23 | # |
| 24 | # This file incorporates work covered by the following copyright and |
| 25 | # permission notice: |
| 26 | # |
| 27 | # Mininet 2.3.0d1 License |
| 28 | # |
| 29 | # Copyright (c) 2013-2016 Open Networking Laboratory |
| 30 | # Copyright (c) 2009-2012 Bob Lantz and The Board of Trustees of |
| 31 | # The Leland Stanford Junior University |
| 32 | # |
| 33 | # Original authors: Bob Lantz and Brandon Heller |
| 34 | # |
| 35 | # We are making Mininet available for public use and benefit with the |
| 36 | # expectation that others will use, modify and enhance the Software and |
| 37 | # contribute those enhancements back to the community. However, since we |
| 38 | # would like to make the Software available for broadest use, with as few |
| 39 | # restrictions as possible permission is hereby granted, free of charge, to |
| 40 | # any person obtaining a copy of this Software to deal in the Software |
| 41 | # under the copyrights without restriction, including without limitation |
| 42 | # the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 43 | # and/or sell copies of the Software, and to permit persons to whom the |
| 44 | # Software is furnished to do so, subject to the following conditions: |
| 45 | # |
| 46 | # The above copyright notice and this permission notice shall be included |
| 47 | # in all copies or substantial portions of the Software. |
| 48 | # |
| 49 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
| 50 | # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 51 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
| 52 | # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY |
| 53 | # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
| 54 | # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
| 55 | # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 56 | # |
| 57 | # The name and trademarks of copyright holder(s) may NOT be used in |
| 58 | # advertising or publicity pertaining to the Software or any derivatives |
| 59 | # without specific, written prior permission. |
| 60 | |
| 61 | from mininet.link import TCLink |
| 62 | from mininet.examples.cluster import RemoteLink, RemoteGRELink |
| 63 | |
| 64 | class RemoteNdnLink( TCLink, RemoteLink ): |
| 65 | "A RemoteLink is a link between nodes which may be on different servers" |
| 66 | |
| 67 | def __init__( self, node1, node2, **kwargs ): |
| 68 | """Initialize a RemoteLink |
| 69 | see Link() for parameters""" |
| 70 | # Create links on remote node |
| 71 | self.node1 = node1 |
| 72 | self.node2 = node2 |
| 73 | self.tunnel = None |
| 74 | kwargs.setdefault( 'params1', {} ) |
| 75 | kwargs.setdefault( 'params2', {} ) |
| 76 | self.cmd = None # satisfy pylint |
| 77 | TCLink.__init__( self, node1, node2, **kwargs ) |
| 78 | |
| 79 | class RemoteGRENdnLink( TCLink, RemoteGRELink ): |
| 80 | def __init__(self, node1, node2, **kwargs): |
| 81 | """Initialize a RemoteLink |
| 82 | see Link() for parameters""" |
| 83 | # Create links on remote node |
| 84 | self.node1 = node1 |
| 85 | self.node2 = node2 |
| 86 | self.tunnel = None |
| 87 | kwargs.setdefault( 'params1', {} ) |
| 88 | kwargs.setdefault( 'params2', {} ) |
| 89 | self.cmd = None # satisfy pylint |
| 90 | TCLink.__init__( self, node1, node2, **kwargs ) |