def parse_line(self, line):
try:<EOL><INDENT>tp = self.split_columns(line)<EOL><DEDENT>except CommentLine:<EOL><INDENT>return<EOL><DEDENT>if tp['<STR_LIT>'] == '<STR_LIT>':  <EOL><INDENT>print("<STR_LIT>", tp['<STR_LIT>'], tp['<STR_LIT:description>'])<EOL>p = Prefix()<EOL>p.schema = self.schema<EOL>p.prefix = tp['<STR_LIT>']<EOL>p.type = '<STR_LIT>'<EOL>p.description = tp['<STR_LIT:description>']<EOL>p.monitor = True<EOL>p.alarm_priority = '<STR_LIT>'<EOL>p.authoritative_source = '<STR_LIT>'<EOL>p.save({})<EOL>return<EOL><DEDENT>elif tp['<STR_LIT>'] == '<STR_LIT:.>' and tp['<STR_LIT:description>'] == '<STR_LIT:.>':<EOL><INDENT>return<EOL><DEDENT>elif tp['<STR_LIT>'] == <NUM_LIT:32>:   <EOL><INDENT>try:<EOL><INDENT>p = Prefix()<EOL>p.schema = self.schema<EOL>p.prefix = tp['<STR_LIT>']<EOL>p.type = '<STR_LIT>'<EOL>p.node = tp['<STR_LIT>']<EOL>p.description = tp['<STR_LIT:description>']<EOL>p.monitor = True<EOL>p.alarm_priority = tp['<STR_LIT>']<EOL>p.authoritative_source = '<STR_LIT>'<EOL>p.save({})<EOL>print("<STR_LIT>", tp['<STR_LIT>'])<EOL>return<EOL><DEDENT>except:<EOL><INDENT>p = Prefix()<EOL>p.schema = self.schema<EOL>p.prefix = tp['<STR_LIT>']<EOL>p.type = '<STR_LIT:host>'<EOL>p.node = tp['<STR_LIT>']<EOL>p.description = tp['<STR_LIT:description>']<EOL>p.monitor = True<EOL>p.alarm_priority = tp['<STR_LIT>']<EOL>p.authoritative_source = '<STR_LIT>'<EOL>p.save({})<EOL>print("<STR_LIT>", tp['<STR_LIT>'])<EOL>return<EOL><DEDENT><DEDENT>elif tp['<STR_LIT>'] == <NUM_LIT:30> or tp['<STR_LIT>'] == <NUM_LIT>:   <EOL><INDENT>octets = tp['<STR_LIT:address>'].split('<STR_LIT:.>')<EOL>prefix_node1 = None<EOL>prefix_node2 = None<EOL>if tp['<STR_LIT>'] == <NUM_LIT:30>:<EOL><INDENT>prefix_node1 = '<STR_LIT:.>'.join(octets[:<NUM_LIT:3>] + [str( int(octets[<NUM_LIT:3>]) + <NUM_LIT:1> )] ) + '<STR_LIT>'<EOL>prefix_node2 = '<STR_LIT:.>'.join(octets[:<NUM_LIT:3>] + [str( int(octets[<NUM_LIT:3>]) + <NUM_LIT:2> )] ) + '<STR_LIT>'<EOL><DEDENT>else:<EOL><INDENT>prefix_node1 = '<STR_LIT:.>'.join(octets) + '<STR_LIT>'<EOL>prefix_node2 = '<STR_LIT:.>'.join(octets[:<NUM_LIT:3>] + [str( int(octets[<NUM_LIT:3>]) + <NUM_LIT:1> )] ) + '<STR_LIT>'<EOL><DEDENT>m = re.match('<STR_LIT>', tp['<STR_LIT>'])<EOL>if m is not None or tp['<STR_LIT:type>'] == '<STR_LIT>':<EOL><INDENT>print("<STR_LIT>", tp['<STR_LIT>'], '<STR_LIT::>', tp['<STR_LIT:description>'])<EOL>p = Prefix()<EOL>p.schema = self.schema<EOL>p.prefix = tp['<STR_LIT>']<EOL>p.type = '<STR_LIT>'<EOL>p.description = tp['<STR_LIT:description>']<EOL>p.alarm_priority = tp['<STR_LIT>']<EOL>p.authoritative_source = '<STR_LIT>'<EOL>if tp['<STR_LIT>'] != '<STR_LIT:.>':<EOL><INDENT>p.order_id = tp['<STR_LIT>']<EOL><DEDENT>p.save({})<EOL>p1 = Prefix()<EOL>p1.schema = self.schema<EOL>p1.prefix = prefix_node1<EOL>p1.type = '<STR_LIT:host>'<EOL>p1.description = '<STR_LIT>'<EOL>p1.authoritative_source = '<STR_LIT>'<EOL>p1.save({})<EOL>p2 = Prefix()<EOL>p2.schema = self.schema<EOL>p2.prefix = prefix_node2<EOL>p2.type = '<STR_LIT:host>'<EOL>p2.node = tp['<STR_LIT>']<EOL>p2.description = '<STR_LIT>'<EOL>p2.authoritative_source = '<STR_LIT>'<EOL>p2.save({})<EOL>return<EOL><DEDENT>m = re.match(r'<STR_LIT>', tp['<STR_LIT:description>'])<EOL>if m is not None:<EOL><INDENT>node1 = m.group(<NUM_LIT:1>)<EOL>node2 = m.group(<NUM_LIT:2>)<EOL>print("<STR_LIT>", tp['<STR_LIT>'], "<STR_LIT:U+0020>", node1, "<STR_LIT>", node2)<EOL>p = Prefix()<EOL>p.schema = self.schema<EOL>p.prefix = tp['<STR_LIT>']<EOL>p.type = '<STR_LIT>'<EOL>p.description = node1 + '<STR_LIT>' + node2<EOL>p.monitor = True<EOL>p.alarm_priority = tp['<STR_LIT>']<EOL>p.authoritative_source = '<STR_LIT>'<EOL>p.save({})<EOL>p1 = Prefix()<EOL>p1.schema = self.schema<EOL>p1.prefix = prefix_node1<EOL>p1.type = '<STR_LIT:host>'<EOL>p1.node = node1<EOL>p1.description = node1<EOL>p1.authoritative_source = '<STR_LIT>'<EOL>p1.save({})<EOL>p2 = Prefix()<EOL>p2.schema = self.schema<EOL>p2.prefix = prefix_node2<EOL>p2.type = '<STR_LIT:host>'<EOL>p2.node = node2<EOL>p2.description = node2<EOL>p2.authoritative_source = '<STR_LIT>'<EOL>p2.save({})<EOL>return<EOL><DEDENT>m = re.match('<STR_LIT>', tp['<STR_LIT>'])<EOL>if m is not None:<EOL><INDENT>print("<STR_LIT>", tp['<STR_LIT>'], '<STR_LIT::>', tp['<STR_LIT:description>'])<EOL>p = Prefix()<EOL>p.schema = self.schema<EOL>p.prefix = tp['<STR_LIT>']<EOL>p.type = '<STR_LIT>'<EOL>p.description = tp['<STR_LIT:description>']<EOL>p.monitor = True<EOL>p.alarm_priority = tp['<STR_LIT>']<EOL>p.authoritative_source = '<STR_LIT>'<EOL>p.save({})<EOL>return<EOL><DEDENT>print("<STR_LIT>", tp['<STR_LIT>'], '<STR_LIT::>', tp['<STR_LIT:description>'])<EOL>p = Prefix()<EOL>p.schema = self.schema<EOL>p.prefix = tp['<STR_LIT>']<EOL>p.type = '<STR_LIT>'<EOL>p.description = tp['<STR_LIT:description>']<EOL>p.monitor = True<EOL>p.alarm_priority = tp['<STR_LIT>']<EOL>p.authoritative_source = '<STR_LIT>'<EOL>p.save({})<EOL>return<EOL><DEDENT>else:<EOL><INDENT>try:<EOL><INDENT>p = Prefix()<EOL>p.schema = self.schema<EOL>p.prefix = tp['<STR_LIT>']<EOL>p.type = '<STR_LIT>'<EOL>p.description = tp['<STR_LIT:description>']<EOL>p.monitor = True<EOL>p.alarm_priority = '<STR_LIT>'<EOL>p.authoritative_source = '<STR_LIT>'<EOL>p.save({})<EOL>print("<STR_LIT>", tp['<STR_LIT>'])<EOL><DEDENT>except NipapValueError as e:<EOL><INDENT>print(tp['<STR_LIT>'], '<STR_LIT::>', e)<EOL>sys.exit(<NUM_LIT:1>)<EOL><DEDENT>return<EOL><DEDENT>
Parse one line