def _add_flat_link_interfaces(self, interfaces, dps, dp_index):
    if (dp_index < (len(dps) - 1)):
        next_dp = dps[(dp_index + 1)]
        next_port = (FLAT_LINK_PORT_START + dp_index)
        description = ('to %s port %s' % (next_dp, next_port))
        interfaces[next_port] = Interface(description=description, stack=StackLink(dp=next_dp, port=next_port))
    if (dp_index > 0):
        prev_dp = dps[(dp_index - 1)]
        prev_port = (FLAT_LINK_PORT_START + (((len(dps) + dp_index) - 1) % len(dps)))
        description = ('to %s port %s' % (prev_dp, prev_port))
        interfaces[prev_port] = Interface(description=description, stack=StackLink(dp=prev_dp, port=prev_port))
def _add_flat_link_interfaces(self, interfaces, dps, dp_index):
    if (dp_index < (len(dps) - 1)):
        next_dp = dps[(dp_index + 1)]
        next_port = (FLAT_LINK_PORT_START + dp_index)
        description = ('to %s port %s' % (next_dp, next_port))
        interfaces[next_port] = Interface(description=description, stack=StackLink(dp=next_dp, port=next_port))
    if (dp_index > 0):
        prev_dp = dps[(dp_index - 1)]
        prev_port = (FLAT_LINK_PORT_START + (((len(dps) + dp_index) - 1) % len(dps)))
        description = ('to %s port %s' % (prev_dp, prev_port))
        interfaces[prev_port] = Interface(description=description, stack=StackLink(dp=prev_dp, port=prev_port))