FRR: print container output and bgpd logs

Related-PRODX: PRODX-56215
Change-Id: I21c90553ca65c0e3456c7b1c723785b7fd9cc9ac
(cherry picked from commit f6cf5cdd214e04e805ecc6cf97d74a992e6a7488)
diff --git a/neutron_tempest_plugin/neutron_dynamic_routing/frr/__init__.py b/neutron_tempest_plugin/neutron_dynamic_routing/frr/__init__.py
index 8505995..28da83c 100644
--- a/neutron_tempest_plugin/neutron_dynamic_routing/frr/__init__.py
+++ b/neutron_tempest_plugin/neutron_dynamic_routing/frr/__init__.py
@@ -18,11 +18,14 @@
 
 import docker
 import jinja2
+from oslo_log import log
 from tempest import config
 import tenacity
 
 
 CONF = config.CONF
+LOG = log.getLogger(__name__)
+BGPD_LOG_PATH = "/var/log/bgpd.log"
 
 
 class GenericConnector:
@@ -48,6 +51,11 @@
         res = self.connector.exec(cmd)
         if res.exit_code == 0:
             return res.output
+
+        LOG.debug("Container %s logs:\n%s\nbgpd:\n%s",
+                  self.connector.ctn.name,
+                  self.connector.ctn.logs(),
+                  self.connector.ctn.exec_run(f"cat {BGPD_LOG_PATH}"))
         raise Exception(f"Failed to run command {cmd}")
 
     def show_bgp_neighbors(self, *args):
@@ -80,6 +88,8 @@
             "bgpd": {"enabled": "yes"},
             "vtysh": {"enabled": "yes"},
         }
+        if self.daemons.get("bgpd"):
+            self.daemons["bgpd"]["log_path"] = BGPD_LOG_PATH
         self.bgpd = bgpd
         self.docker_client = docker.from_env()
         self._create_config_debian()
diff --git a/neutron_tempest_plugin/neutron_dynamic_routing/frr/templates/daemons b/neutron_tempest_plugin/neutron_dynamic_routing/frr/templates/daemons
index 314e231..7f9ccc0 100644
--- a/neutron_tempest_plugin/neutron_dynamic_routing/frr/templates/daemons
+++ b/neutron_tempest_plugin/neutron_dynamic_routing/frr/templates/daemons
@@ -14,7 +14,7 @@
 #
 vtysh_enable={{ daemons.vtysh.enabled }}
 zebra_options="  -A 127.0.0.1 -s 90000000"
-bgpd_options="   -A 127.0.0.1 --listenon {{ daemons.bgpd.listenon }}"
+bgpd_options="   -A 127.0.0.1 --log file:{{ daemons.bgpd.log_path }} --log-level debug --listenon {{ daemons.bgpd.listenon }}"
 ospfd_options="  -A 127.0.0.1"
 ospf6d_options=" -A ::1"
 ripd_options="   -A 127.0.0.1"