title: Read remote configs using Paramiko + CiscoConfParse
body: <p>I've a script that connects to an IPAM tool via api, gets newly created vlans and then performs 'device q {vlan}' on a remote rancid server via paramiko. From this I get a dictionary of devices where the vlans are present.</p>
  
  <p>Function for that is here</p>
  
  <pre><code>def check_rancid_for_vlan():
  vlans = get_vlans()
  
  client = paramiko.SSHClient()
  client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
  client.connect(rancid_host, username=username, password=password)
  
  results = {}
  for i in vlans:
      stdin, stdout, stderr = client.exec_command('cd /var/home/configs; device q Vlan{}'.format(i))
  
      for line in stdout:
          if "no" not in line:
              device = line.split(":")[0]
              if i in results:
                  results[device].append(i)
              else:
                  results[device] = [i]
  
  for key, val in results.iteritems():
      for i in val:
          print(key,i)
  
  client.close()
  </code></pre>
  
  <p>This will output</p>
  
  <pre><code>(u'switch1', 1001)
  (u'switch2', 1002)
  (u'switch3', 1003)
  (u'switch4', 1004)
  </code></pre>
  
  <p>I want to search each config for the vlan and print it. CiscoConfParse allows for searching an interface with </p>
  
  <pre><code>parse.find_objects_w_child(r"interface", vlan)
  </code></pre>
  
  <p>but is there any way to do this remotely over paramiko? Or a better solution potentially?</p>