
import sys
import argparse
from server import xml_server
from connection import http_connection

parser = argparse.ArgumentParser()
parser.add_argument('-p', '--port', type=int, default=8080,
        help="server's HTTP port")
parser.add_argument('--sensordata', type=str,
        default='server/sensor_data.csv', help="sensor data file")

if __name__ == '__main__':
    args = parser.parse_args()
    server = xml_server.XMLServer(args.sensordata)
    connection = http_connection.HttpConnection(server, port=args.port)


import sys
import argparse
from server import xml_server, defective_servers
from connection import http_connection

parser = argparse.ArgumentParser()
parser.add_argument('-p', '--port', type=int, default=8080,
        help="server's HTTP port")
parser.add_argument('--sensordata', type=str,
        default='server/sensor_data.csv', help="sensor data file")
parser.add_argument('--randomloss', action='store_true')

if __name__ == '__main__':
    args = parser.parse_args()
    if args.randomloss:
        server = defective_servers.RandomLossXMLServer(args.sensordata)
    else:
        server = xml_server.XMLServer(args.sensordata)
    connection = http_connection.HttpConnection(server, port=args.port)

Add argument for execution of defective server.
Add argument for execution of defective server.

  
  import sys
  import argparse
- from server import xml_server
+ from server import xml_server, defective_servers
  from connection import http_connection
  
  parser = argparse.ArgumentParser()
  parser.add_argument('-p', '--port', type=int, default=8080,
          help="server's HTTP port")
  parser.add_argument('--sensordata', type=str,
          default='server/sensor_data.csv', help="sensor data file")
+ parser.add_argument('--randomloss', action='store_true')
  
  if __name__ == '__main__':
      args = parser.parse_args()
+     if args.randomloss:
+         server = defective_servers.RandomLossXMLServer(args.sensordata)
+     else:
-     server = xml_server.XMLServer(args.sensordata)
+         server = xml_server.XMLServer(args.sensordata)
      connection = http_connection.HttpConnection(server, port=args.port)
  
Add argument for execution of defective server.
## Code Before:

import sys
import argparse
from server import xml_server
from connection import http_connection

parser = argparse.ArgumentParser()
parser.add_argument('-p', '--port', type=int, default=8080,
        help="server's HTTP port")
parser.add_argument('--sensordata', type=str,
        default='server/sensor_data.csv', help="sensor data file")

if __name__ == '__main__':
    args = parser.parse_args()
    server = xml_server.XMLServer(args.sensordata)
    connection = http_connection.HttpConnection(server, port=args.port)

## Instruction:
Add argument for execution of defective server.
## Code After:

import sys
import argparse
from server import xml_server, defective_servers
from connection import http_connection

parser = argparse.ArgumentParser()
parser.add_argument('-p', '--port', type=int, default=8080,
        help="server's HTTP port")
parser.add_argument('--sensordata', type=str,
        default='server/sensor_data.csv', help="sensor data file")
parser.add_argument('--randomloss', action='store_true')

if __name__ == '__main__':
    args = parser.parse_args()
    if args.randomloss:
        server = defective_servers.RandomLossXMLServer(args.sensordata)
    else:
        server = xml_server.XMLServer(args.sensordata)
    connection = http_connection.HttpConnection(server, port=args.port)
