# terms of the Eclipse Public License v1.0 which accompanies this distribution,
# and is available at http://www.eclipse.org/legal/epl-v10.html
-__author__ = "Radovan Sajben"
-__copyright__ = "Copyright(c) 2015, Cisco Systems, Inc."
-__license__ = "Eclipse Public License v1.0"
-__email__ = "rsajben@cisco.com"
-
import requests
import ipaddr
import argparse
import xml.dom.minidom as md
+__author__ = "Radovan Sajben"
+__copyright__ = "Copyright(c) 2015, Cisco Systems, Inc."
+__license__ = "Eclipse Public License v1.0"
+__email__ = "rsajben@cisco.com"
+
+
def _build_url(odl_ip, port, uri):
"""Compose URL from generic IP, port and URI fragment.
if "prefix" in item:
prefixes += item + ","
prefix_count += 1
- prefixes = prefixes[:len(prefixes)-1]
+ prefixes = prefixes[:len(prefixes) - 1]
logger.debug("prefix_list=%s", prefixes)
logger.info("prefix_count=%s", prefix_count)
"""
logger.info("Delete %s prefix(es) (starting from %s/%s) from %s:%s/restconf/%s",
count, prefix_base, prefix_len, odl_ip, port, uri)
+ partkey = "" if args.stream in ["stable-lithium", "beryllium"] else "/0"
uri_del_prefix = uri + _uri_suffix_ipv4_routes + _uri_suffix_ipv4_route
prefix_gap = 2 ** (32 - prefix_len)
for prefix_index in range(count):
prefix = prefix_base + prefix_index * prefix_gap
- logger.info("Deleting prefix %s/%s from %s:%s/restconf/%s",
- prefix, prefix_len, odl_ip, port, uri)
+ logger.info("Deleting prefix %s/%s/%s from %s:%s/restconf/%s",
+ prefix, prefix_len, partkey, odl_ip, port, uri)
send_request("DELETE", odl_ip, port,
- uri_del_prefix + str(prefix) + "%2F" + str(prefix_len), auth)
+ uri_del_prefix + str(prefix) + "%2F" + str(prefix_len) + partkey, auth)
def delete_all_prefixes(odl_ip, port, uri, auth, prefix_base=None,
const=logging.DEBUG, default=logging.INFO,
help="Set log level to debug (default is info)")
parser.add_argument("--logfile", default="bgp_app_peer.log", help="Log file name")
+ parser.add_argument("--stream", default="", help="Stream - beryllium, boron ...")
args = parser.parse_args()
count = args.count
auth = (args.user, args.password)
uri = args.uri
- xml_template = args.xml
+ xml_template = "{}.{}".format(args.xml, args.stream) if args.stream in ["stable-lithium", "beryllium"] else args.xml
test_start_time = time.time()
total_build_data_time_counter = 0