Python Forum
TTP: Line not being included but should match
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
TTP: Line not being included but should match
#1
I don't understand why one line of my data is not being matched in TTP.

Using the template and data found below, I would expect to see {'slot_12': {'port_0': {'power_level': '360'} in my results, but the last line which contains that information is not being matched.

Data:
configure interface cable-downstream 12/0 ofdm excluded-bw low-frequency 749000000 high-frequency 757000000
configure interface cable-downstream 12/0 ofdm excluded-bw low-frequency 851000000 high-frequency 865000000
configure interface cable-downstream 12/0/0 cable cable-mac 1
configure interface cable-downstream 12/0/0 cable channel-id 1
configure interface cable-downstream 12/0/0 cable dsg tunnel-group 1
configure interface cable-downstream 12/0/0 cable dsg tunnel-group 2
configure interface cable-downstream 12/0/0 cable dsg tunnel-group 3
configure interface cable-downstream 12/0/0 cable load-balance group 1
configure interface cable-downstream 12/0/0 cable shutdown
configure interface cable-downstream 12/0/1 cable cable-mac 1
configure interface cable-downstream 12/0/1 cable channel-id 2
configure interface cable-downstream 12/0/1 cable primary-capable no
configure interface cable-downstream 12/0/1 cable load-balance group 1
configure interface cable-downstream 12/0/1 cable no shutdown
configure interface cable-downstream 12/0/32 ofdm cable-mac 1
configure interface cable-downstream 12/0/32 ofdm channel-id 33
configure interface cable-downstream 12/0/32 ofdm primary-capable no
configure interface cable-downstream 12/0/32 ofdm ds-profile 0 default-modulation 64qam
configure interface cable-downstream 12/0/32 ofdm ds-profile 1 default-modulation 1024qam
configure interface cable-downstream 12/0/32 ofdm no shutdown
configure interface cable-downstream 12/0 power-level 360
Template:
<group name="slot_{{ slot }}">
 <group name="port_{{ port }}">
  <group name="exclusions">
configure interface cable-downstream {{ slot }}/{{ port }} {{ ignore }} excluded-bw low-frequency {{ ofdm_excluded_low }} high-frequency {{ ofdm_excluded_high }}
  </group>
  <group name="channels">
   <group name="channel_{{ channel }}">
configure interface cable-downstream {{ slot }}/{{ port }}/{{ channel }} {{ type }} cable-mac {{ cable_mac }}
configure interface cable-downstream {{ slot }}/{{ port }}/{{ channel }} {{ type }} channel-id {{ channel_id }}
configure interface cable-downstream {{ slot }}/{{ port }}/{{ channel }} {{ type }} primary-capable {{ primary_capable | let(False) | default(True) }}
    <group name="tunnel_groups" method="table">
configure interface cable-downstream {{ slot }}/{{ port }}/{{ channel }} {{ ignore }} dsg tunnel-group {{ tunnel_group }}
    </group>
configure interface cable-downstream {{ slot }}/{{ port }}/{{ channel }} {{ type }} load-balance group {{ load_balance_group }}
    <group name="ds_profiles">
configure interface cable-downstream {{ slot }}/{{ port }}/{{ channel }} {{ ignore }} ds-profile {{ profile }} default-modulation {{ modulation }}
    </group>
configure interface cable-downstream {{ slot }}/{{ port }}/{{ channel }} {{ type }} {{ shutdown | let(False) | default(True) }} shutdown
   </group>
  </group>
configure interface cable-downstream {{ slot }}/{{ port }} power-level {{ power_level }}
 </group>
</group>
The results that I am getting is:
[{'slot_12': {'port_0': {'exclusions': [{'ofdm_excluded_low': '749000000',
                                         'ofdm_excluded_high': '757000000'},
                                        {'ofdm_excluded_low': '851000000',
                                         'ofdm_excluded_high': '865000000'}],
                         'channels': {'channel_0': {'type': 'cable',
                                                    'channel_id': '1',
                                                    'cable_mac': '1',
                                                    'primary_capable': True,
                                                    'shutdown': True,
                                                    'tunnel_groups': [{'tunnel_group': '1'},
                                                                      {'tunnel_group': '2'},
                                                                      {'tunnel_group': '3'}],
                                                    'load_balance_group': '1'},
                                      'channel_1': {'type': 'cable',
                                                    'shutdown': False,
                                                    'load_balance_group': '1',
                                                    'primary_capable': False,
                                                    'channel_id': '2',
                                                    'cable_mac': '1'},
                                      'channel_32': {'type': 'ofdm',
                                                     'primary_capable': False,
                                                     'channel_id': '33',
                                                     'cable_mac': '1',
                                                     'shutdown': False,
                                                     'ds_profiles': [{'profile': '0',
                                                                      'modulation': '64qam'},
                                                                     {'profile': '1',
                                                                      'modulation': '1024qam'}]}}}}}]
...and you can see that the last line (regarding power-level) in my data wasn't included. It should be at the same level as the "exclusions" and the "channels".
Reply
#2
If I place the line into its own group, then it seems to match:

...
configure interface cable-downstream {{ slot }}/{{ port }}/{{ channel }} {{ type }} {{ shutdown | let(False) | default(True) }} shutdown
   </group>
  </group>
  <group name="power">
configure interface cable-downstream {{ slot }}/{{ port }} power-level {{ power_level }}
  </group>
 </group>
</group>
...
                                                     'ds_profiles': [{'profile': '0',
                                                                      'modulation': '64qam'},
                                                                     {'profile': '1',
                                                                      'modulation': '1024qam'}]}},
                         'power': {'power_level': '360'}}}}]
Why does it need to be in a group to match? I would prefer to have {"power_levels": 360} instead of {"power": {"power_level": 360}}
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020