+ chapters[chapter_l1][chapter_l2][nic][u"tables"].append(
+ (
+ table_lst.pop(idx),
+ suite[u"doc"].replace(u'"', u"'").
+ replace(u'\n', u' ').
+ replace(u'\r', u'').
+ replace(u'*[', u'\n\n - *[').
+ replace(u"*", u"**").
+ replace(u'\n\n - *[', u' - *[', 1)
+ )
+ )
+ break
+ titles = {
+ # VPP Perf, MRR
+ u"container_memif": u"LXC/DRC Container Memif",
+ u"crypto": u"IPsec IPv4 Routing",
+ u"hoststack": u"Hoststack Testing",
+ u"ip4": u"IPv4 Routing",
+ u"ip4_tunnels": u"IPv4 Tunnels",
+ u"ip6": u"IPv6 Routing",
+ u"ip6_tunnels": u"IPv6 Tunnels",
+ u"l2": u"L2 Ethernet Switching",
+ u"lb": u"LoadBalancer",
+ u"nfv_density": u"NFV Service Density",
+ u"srv6": u"SRv6 Routing",
+ u"vm_vhost": u"KVM VMs vhost-user",
+ u"vts": u"Virtual Topology System",
+ # VPP Device
+ u"interfaces": u"Interfaces",
+ u"l2bd": u"L2 Bridge-domain",
+ u"l2patch": u"L2 Patch",
+ u"l2xc": u"L2 Cross-connect",
+ }
+
+ order_chapters = file_spec.get(u"order-chapters", None)
+
+ if order_chapters:
+ order_1 = order_chapters.get(u"level-1", None)
+ order_2 = order_chapters.get(u"level-2", None)
+ order_3 = order_chapters.get(u"level-3", None)
+ if not order_1:
+ order_1 = chapters.keys()
+ else:
+ order_1 = None
+ order_2 = None
+ order_3 = None
+
+ for chapter_l1 in order_1:
+ content_l1 = chapters.get(chapter_l1, None)
+ if not content_l1:
+ continue
+ with open(f"{fileset_file_name}/index.rst", u"a") as file_handler:
+ file_handler.write(f" {chapter_l1}\n")
+ l1_file_name = f"{join(fileset_file_name, chapter_l1)}.rst"
+ title = titles.get(chapter_l1, chapter_l1)
+ logging.info(f" Generating {title} ...")
+ with open(l1_file_name, u"w") as file_handler:
+ file_handler.write(
+ f"{title}\n"
+ f"{get_rst_title_char(1) * len(title)}\n\n"
+ f".. toctree::\n\n"
+ )
+
+ if not order_2:
+ order_2 = chapters[chapter_l1].keys()
+ for chapter_l2 in order_2:
+ content_l2 = content_l1.get(chapter_l2, None)
+ if not content_l2:
+ continue
+ if not order_3:
+ order_3 = chapters[chapter_l1][chapter_l2].keys()
+ for chapter_l3 in order_3:
+ content_l3 = content_l2.get(chapter_l3, None)
+ if not content_l3:
+ continue
+ with open(l1_file_name, u"a") as file_handler:
+ item = u"/".join(content_l3[u'rst_file'].split(u'/')[-2:])
+ file_handler.write(f" ../{item}\n")
+ logging.info(f" Writing the file {content_l3[u'rst_file']}")
+ with open(content_l3[u'rst_file'], u"w+") as file_handler:
+ title = f"{chapter_l2}-{chapter_l3}"
+ file_handler.write(
+ f"{rst_header}\n"
+ f"{title}\n"
+ f"{get_rst_title_char(2) * len(title)}\n"
+ )
+ for table in content_l3[u'tables']:
+ title = table[0].split(u"/")[-1].split(u".")[0]