Commit fad005f6 authored by Pedro Oliveira's avatar Pedro Oliveira

Install pim-dm through setup.py

parent 86a3a202
...@@ -17,47 +17,56 @@ You may need sudo permissions, in order to run this protocol. This is required b ...@@ -17,47 +17,56 @@ You may need sudo permissions, in order to run this protocol. This is required b
First clone this repository: First clone this repository:
`git clone https://github.com/pedrofran12/pim_dm.git` `git clone https://github.com/pedrofran12/pim_dm.git`
Then enter in the cloned repository and install all dependencies: Then enter in the cloned repository and install the protocol:
`pip3 install -r requirements.txt` `sudo python3 setup.py install`
And that's it :D And that's it :D
# Run protocol # Run protocol
In order to interact with the protocol you need to allways execute Run.py file. You can interact with the protocol by executing this file and specifying a command and corresponding arguments: To interact with the protocol you need to execute the `pim-dm` command. You may need to specify a command and corresponding arguments:
`sudo python3 Run.py -COMMAND ARGUMENTS` `pim-dm -COMMAND ARGUMENTS`
In order to determine which commands are available you can call the help command: In order to determine which commands are available you can call the help command:
`sudo python3 Run.py -h`
`pim-dm -h`
or or
`sudo python3 Run.py --help`
`pim-dm --help`
In order to start the protocol you first need to explicitly start it. This will start a daemon process, which will be running in the background. The command is the following: In order to start the protocol you first need to explicitly start it. This will start a daemon process, which will be running in the background. The command is the following:
`sudo python3 Run.py -start`
`sudo pim-dm -start`
Then you can enable the protocol in specific interfaces. You need to specify which interfaces will have IGMP enabled and which interfaces will have the PIM-DM enabled. Then you can enable the protocol in specific interfaces. You need to specify which interfaces will have IGMP enabled and which interfaces will have the PIM-DM enabled.
To enable PIM-DM, without State-Refresh, in a given interface, you need to run the following command: To enable PIM-DM, without State-Refresh, in a given interface, you need to run the following command:
`sudo python3 Run.py -ai INTERFACE_NAME`
`sudo pim-dm -ai INTERFACE_NAME`
To enable PIM-DM, with State-Refresh, in a given interface, you need to run the following command: To enable PIM-DM, with State-Refresh, in a given interface, you need to run the following command:
`sudo python3 Run.py -aisf INTERFACE_NAME`
`sudo pim-dm -aisf INTERFACE_NAME`
To enable IGMP in a given interface, you need to run the following command: To enable IGMP in a given interface, you need to run the following command:
`sudo python3 Run.py -aiigmp INTERFACE_NAME`
`sudo pim-dm -aiigmp INTERFACE_NAME`
If you have previously enabled an interface without State-Refresh and want to enable it, in the same interface, you first need to disable this interface, and the run the command -aisr. The same happens when you want to disable State Refresh in a previously enabled StateRefresh interface. If you have previously enabled an interface without State-Refresh and want to enable it, in the same interface, you first need to disable this interface, and the run the command -aisr. The same happens when you want to disable State Refresh in a previously enabled StateRefresh interface.
To remove a previously added interface, you need run the following commands: To remove a previously added interface, you need run the following commands:
To remove a previously added PIM-DM interface: To remove a previously added PIM-DM interface:
`sudo python3 Run.py -ri INTERFACE_NAME` `sudo pim-dm -ri INTERFACE_NAME`
To remove a previously added IGMP interface: To remove a previously added IGMP interface:
`sudo python3 Run.py -riigmp INTERFACE_NAME`
`sudo pim-dm -riigmp INTERFACE_NAME`
If you want to stop the protocol process, and stop the daemon process, you need to explicitly run this command: If you want to stop the protocol process, and stop the daemon process, you need to explicitly run this command:
`sudo python3 Run.py -stop`
`sudo pim-dm -stop`
...@@ -66,15 +75,15 @@ We have built some list commands that can be used to check the "internals" of th ...@@ -66,15 +75,15 @@ We have built some list commands that can be used to check the "internals" of th
- List neighbors: - List neighbors:
Verify neighbors that have established a neighborhood relationship Verify neighbors that have established a neighborhood relationship
`sudo python3 Run.py -ln` `sudo pim-dm -ln`
- List state: - List state:
List all state machines and corresponding state of all trees that are being monitored. Also list IGMP state for each group being monitored. List all state machines and corresponding state of all trees that are being monitored. Also list IGMP state for each group being monitored.
`sudo python3 Run.py -ls` `sudo pim-dm -ls`
- Multicast Routing Table: - Multicast Routing Table:
List Linux Multicast Routing Table (equivalent to ip mroute -show) List Linux Multicast Routing Table (equivalent to ip mroute -show)
`sudo python3 Run.py -mr` `sudo pim-dm -mr`
## Change settings ## Change settings
......
...@@ -15,7 +15,7 @@ def client_socket(data_to_send): ...@@ -15,7 +15,7 @@ def client_socket(data_to_send):
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
# Connect the socket to the port where the server is listening # Connect the socket to the port where the server is listening
server_address = './uds_socket' server_address = '/tmp/pim_uds_socket'
#print('connecting to %s' % server_address) #print('connecting to %s' % server_address)
try: try:
sock.connect(server_address) sock.connect(server_address)
...@@ -33,7 +33,7 @@ def client_socket(data_to_send): ...@@ -33,7 +33,7 @@ def client_socket(data_to_send):
class MyDaemon(Daemon): class MyDaemon(Daemon):
def run(self): def run(self):
Main.main() Main.main()
server_address = './uds_socket' server_address = '/tmp/pim_uds_socket'
# Make sure the socket does not already exist # Make sure the socket does not already exist
try: try:
...@@ -92,10 +92,11 @@ class MyDaemon(Daemon): ...@@ -92,10 +92,11 @@ class MyDaemon(Daemon):
connection.close() connection.close()
def main():
"""
if __name__ == "__main__": Entry point for PIM-DM
parser = argparse.ArgumentParser(description='PIM') """
parser = argparse.ArgumentParser(description='PIM-DM protocol')
group = parser.add_mutually_exclusive_group(required=True) group = parser.add_mutually_exclusive_group(required=True)
group.add_argument("-start", "--start", action="store_true", default=False, help="Start PIM") group.add_argument("-start", "--start", action="store_true", default=False, help="Start PIM")
group.add_argument("-stop", "--stop", action="store_true", default=False, help="Stop PIM") group.add_argument("-stop", "--stop", action="store_true", default=False, help="Stop PIM")
...@@ -113,7 +114,7 @@ if __name__ == "__main__": ...@@ -113,7 +114,7 @@ if __name__ == "__main__":
group.add_argument("-t", "--test", nargs=2, metavar=('ROUTER_NAME', 'SERVER_LOG_IP'), help="Tester... send log information to SERVER_LOG_IP. Set the router name to ROUTER_NAME") group.add_argument("-t", "--test", nargs=2, metavar=('ROUTER_NAME', 'SERVER_LOG_IP'), help="Tester... send log information to SERVER_LOG_IP. Set the router name to ROUTER_NAME")
args = parser.parse_args() args = parser.parse_args()
print(parser.parse_args()) #print(parser.parse_args())
daemon = MyDaemon('/tmp/Daemon-pim.pid') daemon = MyDaemon('/tmp/Daemon-pim.pid')
if args.start: if args.start:
...@@ -128,7 +129,7 @@ if __name__ == "__main__": ...@@ -128,7 +129,7 @@ if __name__ == "__main__":
daemon.restart() daemon.restart()
sys.exit(0) sys.exit(0)
elif args.verbose: elif args.verbose:
os.system("tailf stdout") os.system("tail -f stdout")
sys.exit(0) sys.exit(0)
elif args.multicast_routes: elif args.multicast_routes:
os.system("ip mroute show") os.system("ip mroute show")
...@@ -139,3 +140,7 @@ if __name__ == "__main__": ...@@ -139,3 +140,7 @@ if __name__ == "__main__":
sys.exit(0) sys.exit(0)
client_socket(args) client_socket(args)
if __name__ == "__main__":
main()
...@@ -2,4 +2,3 @@ PrettyTable ...@@ -2,4 +2,3 @@ PrettyTable
netifaces netifaces
ipaddress ipaddress
pyroute2 pyroute2
rpyc
\ No newline at end of file
import sys
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
# we only support Python 3 version >= 3.4
#if len(sys.argv) >= 2 and sys.argv[1] == "install" and sys.version_info < (3, 4):
# raise SystemExit("Python 3.4 or higher is required")
dependencies = open("requirements.txt", "r").read().splitlines()
setup(
name="pim-dm",
version="1.0",
url="http://github.com/pedrofran12/pim_dm",
license="MIT",
description="PIM-DM protocol",
long_description=open("README.md", "r").read(),
install_requires=dependencies,
packages=find_packages(exclude=["docs"]),
py_modules=["Run", "Interface", "InterfaceIGMP", "InterfacePIM", "Kernel", "Main", "Neighbor",
"TestLogger", "UnicastRouting", "utils"],
entry_points={
"console_scripts": [
"pim-dm = Run:main",
]
},
include_package_data=True,
zip_safe=False,
platforms="any",
classifiers=[
"Development Status :: 4 - Beta",
"Environment :: Console",
"Intended Audience :: Information Technology",
"Topic :: System :: Networking",
"License :: OSI Approved :: MIT License",
"Natural Language :: English",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
],
)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment