rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
def interfaceConfiguration(name, ip):
def interfaceConfiguration(name):
def interfaceConfiguration(name, ip): f.write('Interface "{0}"\n'.format(name)) f.write('{\n') f.write(' IPv4Multicast 255.255.255.255\n') if ip is not None: f.write(' IPv4Src {0}\n'.format(ip)) f.write(' HelloInterval 5.0\n') f.write(' HelloValidityTime 40.0\n') f.write(' TcInterval 7.0\n') f.write(' TcValidityT...
if ip is not None: f.write(' IPv4Src {0}\n'.format(ip))
def interfaceConfiguration(name, ip): f.write('Interface "{0}"\n'.format(name)) f.write('{\n') f.write(' IPv4Multicast 255.255.255.255\n') if ip is not None: f.write(' IPv4Src {0}\n'.format(ip)) f.write(' HelloInterval 5.0\n') f.write(' HelloValidityTime 40.0\n') f.write(' TcInterval 7.0\n') f.write(' TcValidityT...
interfaceConfiguration(interface['name'], interface['ip'])
interfaceConfiguration(interface['name'])
def interfaceConfiguration(name, ip): f.write('Interface "{0}"\n'.format(name)) f.write('{\n') f.write(' IPv4Multicast 255.255.255.255\n') if ip is not None: f.write(' IPv4Src {0}\n'.format(ip)) f.write(' HelloInterval 5.0\n') f.write(' HelloValidityTime 40.0\n') f.write(' TcInterval 7.0\n') f.write(' TcValidityT...
f.write('\n') f.write(' f.write('config alias routerid\n') f.write('\toption interface loopback\n') f.write('\toption proto static\n') f.write('\toption ipaddr %s\n' % self.ip) f.write('\toption netmask 255.255.255.255\n')
def __generateNetworkConfig(self, f): # VLAN configuration layout = portLayouts[self.portLayout] if isinstance(layout, tuple): f.write('#### VLAN configuration\n') f.write('config switch %s\n' % ("eth0" if not self.portLayout in switchIds else switchIds[self.portLayout])) f.write('\toption vlan0 "%s"\n' % layout[0]) f...
if not self.profile:
from wlanlj.generator.models import Profile try: self.profile except Profile.DoesNotExist:
def adapt_to_router_type(self): """ Ensures that new router type is compatible with current configuration. """ if not self.profile: return for entry in self.profile.template.adaptation_chain.all().order_by("priority"): cls = load_plugin(entry.class_name, required_super = RouterTransition) transition = cls() transition...
if db_backend.startswith('postgresql'):
if db_backend.find('postgresql') != -1:
def ensure_success(errcode): if errcode != 0: print "ERROR: Command failed to execute, aborting!" exit(1)
elif db_backend.startswith('sqlite'):
elif db_backend.find('sqlite') != -1:
def ensure_success(errcode): if errcode != 0: print "ERROR: Command failed to execute, aborting!" exit(1)
elif db_backend.startswith('mysql'):
elif db_backend.find('mysql') != -1:
def ensure_success(errcode): if errcode != 0: print "ERROR: Command failed to execute, aborting!" exit(1)
return _("unknown nodes")
return _("Unknown nodes")
def node_type_as_string_plural(self): """ Returns node type as string. """ if self.node_type == NodeType.Mesh: return _("Mesh nodes") elif self.node_type == NodeType.Server: return _("Server nodes") elif self.node_type == NodeType.Test: return _("Test nodes") elif self.node_type == NodeType.Mobile: return _("Mobile nod...
twitter_api = twitter.Api(username=settings.TWITTER_USERNAME, settings.TWITTER_PASSWORD)
twitter_api = twitter.Api(username = settings.TWITTER_USERNAME, password = settings.TWITTER_PASSWORD)
def generate_new_node_tweet(node): if not tweets_enabled(): return try: bit_api = bitly.Api(login=settings.BITLY_LOGIN, apikey=settings.BITLY_API_KEY) twitter_api = twitter.Api(username=settings.TWITTER_USERNAME, settings.TWITTER_PASSWORD) node_link = bit_api.shorten(node.get_url()) msg = "A new node %s has just connec...
if n.profile: iface_wifi = n.profile.template.iface_wifi if Template.objects.filter(iface_wifi = iid).count() >= 1: iid = iface_wifi
try: if n.profile: iface_wifi = n.profile.template.iface_wifi if Template.objects.filter(iface_wifi = iid).count() >= 1: iid = iface_wifi except Profile.DoesNotExist: pass
def process_node(node_ip, ping_results, is_duped, peers, varsize_results): """ Processes a single node. @param node_ip: Node's IP address @param ping_results: Results obtained from ICMP ECHO tests @param is_duped: True if duplicate echos received @param peers: Peering info from routing daemon @param varsize_results: R...
l = hna.setdefault(ip, []) l.append('%s/32' % alias)
for x in alias: l = hna.setdefault(ip, []) l.append('%s/32' % x)
def parse_tables(data): """ Parses the OLSR routing tables. """ isTable = False isTableHead = False currentTable = '' nodes = {} hna = {} for line in data.splitlines(): line = line.strip() if line[0:6] == 'Table:' and line[7:] in ('Topology', 'HNA', 'MID'): isTable = True isTableHead = True currentTable = line[7:] co...
return item.get_full_url()
return item.node.get_full_url()
def item_link(self, item): return item.get_full_url()
"LINE1:loss_def r'GPRINT:loss_def:LAST: Current\:%8.2lf', r'GPRINT:loss_def:AVERAGE:Average\:%8.2lf', r'GPRINT:loss_def:MAX:Maximum\:%8.2lf\n', "LINE1:loss_100 r'GPRINT:loss_100:LAST: Current\:%8.2lf', r'GPRINT:loss_100:AVERAGE:Average\:%8.2lf', r'GPRINT:loss_100:MAX:Maximum\:%8.2lf\n', "LINE1:loss_500 r'GPRINT:loss_5...
"CDEF:nloss_def=loss_def,100,/", "CDEF:nloss_100=loss_100,100,/", "CDEF:nloss_500=loss_500,100,/", "CDEF:nloss_1000=loss_1000,100,/", "CDEF:nloss_1480=loss_1480,100,/", "LINE1:nloss_def r'GPRINT:nloss_def:LAST: Current\:%8.2lf', r'GPRINT:nloss_def:AVERAGE:Average\:%8.2lf', r'GPRINT:nloss_def:MAX:Maximum\:%8.2lf\n', "...
def __str__(self): return "DS:%s:%s:%s:U:U" % (self.name, self.type, self.heartbeat)
'--upper-limit', '100'
'--upper-limit', '1'
def __str__(self): return "DS:%s:%s:%s:U:U" % (self.name, self.type, self.heartbeat)
if len(wifiSubnet) and n.clients >= ipcalc.Network(wifiSubnet[0].subnet, wifiSubnet[0].cidr).size() - 4:
if len(wifiSubnet) and n.clients > max(0, ipcalc.Network(wifiSubnet[0].subnet, wifiSubnet[0].cidr).size() - 4):
def process_node(node_ip, ping_results, is_duped, peers): """ Processes a single node. @param node_ip: Node's IP address @param ping_results: Results obtained from ICMP ECHO tests @param is_duped: True if duplicate echos received @param peers: Peering info from routing daemon """ transaction.set_dirty() try: n = Node...
last_updated = graph.last_update,
last_update = graph.last_update,
def draw_graph(graph_id, timespan): """ Draws the specified graph. @param graph_id: Graph primary key @param timespan: Timespan to draw the graph for @return: True on success, False on failure """ logger = draw_graph.get_logger() # First check that we haven't drawn this graph already result = cache.get('nodewatcher.g...
upload_limit = safe_int_convert(info['net']['vpn']['upload_limit'][:-3]) // 1000
offset = -3 unit = 1000 if 'Kbit' in info['net']['vpn']['upload_limit']: offset = -4 unit = 1 upload_limit = safe_int_convert(info['net']['vpn']['upload_limit'][:offset]) // unit
def process_node(node_ip, ping_results, is_duped, peers, varsize_results): """ Processes a single node. @param node_ip: Node's IP address @param ping_results: Results obtained from ICMP ECHO tests @param is_duped: True if duplicate echos received @param peers: Peering info from routing daemon @param varsize_results: R...
NodeWarning.create(n, WarningCode.AnnounceConflict, EventSource.Monitor)
NodeWarning.create(n, WarningCode.UnregisteredAnnounce, EventSource.Monitor)
def check_mesh_status(): """ Performs a mesh status check. """ # Initialize the state of nodes and subnets, remove out of date ap clients and graph items Node.objects.all().update(visible = False) Subnet.objects.all().update(visible = False) APClient.objects.filter(last_update__lt = datetime.now() - timedelta(minutes ...
self.fields['prefix_%s' % subnet.pk] = forms.IntegerField()
self.fields['prefix_%s' % subnet.pk] = forms.IntegerField(required = False, initial = 27)
def __init__(self, user, node, *args, **kwargs): """ Class constructor. """ super(RenumberForm, self).__init__(*args, **kwargs) self.__node = node # Use renumber with subnet only when this is possible self.fields['primary_ip'] = forms.ChoiceField( choices = [ (RenumberAction.SetManually, _("Set manually")) ], initial ...
return _("If this is not intentional, you are using an old firmware version or it is a bug. In the later case please report it. If it is intentional, please get in contact with network administrators to arrange a configuration option in the firmware for it.")
return _("If this is not intentional, it is a bug. Please report it. If it is intentional, please get in contact with network administrators to arrange a configuration option in the firmware for it.")
def to_help_string(code): """ A helper method for transforming a warning code to a human readable help string.
for key, value in info['solar'].iteritems(): if not value.strip(): info['solar'][key] = None
def process_node(node_ip, ping_results, is_duped, peers, varsize_results): """ Processes a single node. @param node_ip: Node's IP address @param ping_results: Results obtained from ICMP ECHO tests @param is_duped: True if duplicate echos received @param peers: Peering info from routing daemon @param varsize_results: R...
states.get(info['solar']['state'], 1),
states.get(info['solar']['state']),
def process_node(node_ip, ping_results, is_duped, peers, varsize_results): """ Processes a single node. @param node_ip: Node's IP address @param ping_results: Results obtained from ICMP ECHO tests @param is_duped: True if duplicate echos received @param peers: Peering info from routing daemon @param varsize_results: R...
result = "%s-%s-%s%s-%s%s" % (d['hostname'], d['router_name'], version, ("-%s" % type if type else ""), filechecksum, ext)
router_name = d['router_name'].replace('-', '') result = "%s-%s-%s%s-%s%s" % (d['hostname'], router_name, version, ("-%s" % type if type else "-all"), filechecksum, ext)
def generate_image(d): """ Generates an image accoording to given configuration. """ logging.debug(repr(d)) if d['imagebuilder'] not in IMAGEBUILDERS: raise Exception("Invalid imagebuilder specified!") x = OpenWrtConfig() x.setUUID(d['uuid']) x.setOpenwrtVersion(d['openwrt_ver']) x.setArch(d['arch']) x.setPortLayout(...
raise TemplateSyntaxError("'%s' tag expected format is 'as name'" % args[0])
raise template.TemplateSyntaxError("'%s' tag expected format is 'as name'" % args[0])
def setcontext(parser, token): """ Sets (updates) current template context with the rendered output of the block inside tags. """ nodelist = parser.parse(('endsetcontext',)) args = list(token.split_contents()) if len(args) != 3 or args[1] != "as": raise TemplateSyntaxError("'%s' tag expected format is 'as name'" % arg...
raise TemplateSyntaxError("'%s' tag requires at most two arguments" % args[0])
raise template.TemplateSyntaxError("'%s' tag requires at most two arguments" % args[0])
def notice(parser, token): """ Renders notice. """ nodelist = parser.parse(('endnotice',)) args = list(token.split_contents()) if len(args) > 3: raise TemplateSyntaxError("'%s' tag requires at most two arguments" % args[0]) classes = args[2] if len(args) > 2 else '""' notice_type = args[1] if len(args) > 1 else '""' ...
form = InfoStickerForm({
form = InfoStickerForm(initial = {
def sticker(request): """ Display a form for generating an info sticker. """ user = UserAccount.for_user(request.user) # We want disabled error to show only after POST (to be same as image generation behavior) disabled = False if request.method == 'POST': form = InfoStickerForm(request.POST) if form.is_valid(): if get...