Version0 /
Discovery developer's guidePtolemy host instructions
ProblemsName prints as ?; IP and MAC are fineUnfortunately, there are many possible causes of a local name resolution issue. Local name resolution happens through a variety of protocols. The protocol used is machine-dependent. Under Mavericks (Mac OS X 10.9.x), the following did not work, Command-7 did not bring up the Bonjour Services, nor was it available in the View menu. Wireless Diagnostics (2013/06/08) states that Bonjour Services was removed in Mac OS X 10.8.4 and still not present in Yosemite OS X 10.10 Yosemite Beta 3. http://www.cnet.com/news/use-wi-fi-diagnostics-to-find-active-bonjour-services-in-os-x/ states: "For Mac please try the following:"
Under Mavericks (Mac OS X 10.9), Safari can be used to browse Bonjour: Bonjour has stopped working states: "Note that you can enable a Bonjour browser function in Safari. Open Safari preferences, select Advanced and you will see a Bonjour section where you can add Bonjour to your Favorites bar. With this selected you will see all Bonjour devices on your local network."
If devices are missing, it is possible that those devices do not support Bonjour, or that your router does not support Bonjour.
https://community.linksys.com/t5/Wireless-Routers/Routers-compatible-with-Airplay-and-Bonjour/td-p/493842
"On the Mac turn on Windows file-sharing. That will then activate Samba on the Mac, and lets it query NetBIOS names directly. It seems to configure WINS correctly, automatically, although irritatingly hidden. With the sharing on, most Windows operations seems to work easier." 10.5: http://serverfault.com/questions/13337/os-x-cant-resolve-windows-machine-names Running fails with ArrayToken(Token[]) called with a an array of length less than 1.java.lang.RuntimeException: ptolemy.kernel.util.IllegalActionException: ArrayToken(Token[]) called with a an array of length less than 1. To create an array of length 0, use the ArrayToken(Token) constructor or the "emptyArray(type)" function in the expression language. The reason is that elements in ArrayToken must have a type. An interim fix for this was checked in to "In localFunctions.js, we could modify convertToToken() to take an optional second argument, the port proxy, which is an instance of JavaScript.PortOrParameterProxy. If the second argument is provided, it could be used to resolve type ambiguities. To do this, we would need to augment PortOrParameterProxy with a method like getType(). This would return the type of the port. This could then be used in the JavaScript code to decide what type of ArrayToken to create. Alternatively, and perhaps easier, would be to create a more specialized method in PortOrParameterProxy, say getArrayElementType() that returns an instance of Type if the type of the port is an array, and return null otherwise. Then the JS code could change to:" if (proxy) { var type = proxy.getArrayElementType(); if (type) { return new ArrayToken(type); } } // No type information available, so convert to an empty [string] array return new ArrayToken(BaseType.STRING); AccessorJS host instructions
AccessorJS currently uses the XML version of the accessor specification. Node.js host instructionsThe Node implementation uses Javascript Promises to ping devices asynchronously, then wait until all pings are finished before performing an arp command, then producing the results on the Install Node.js, pull SwarmOS repository, run setup scriptsSee: http://www.terraswarm.org/platforms/wiki/Main/NodeJsAccessors Quick instructions:
Roll back accessor.js to get Accessor.makeFromURL()This accessor uses an old version of
Start fileserver.jsChange to the node fileserver.js& This will start a fileserver to serve the accessor from your local machine. Problem: Unhandled 'error' event: EACESSUnder Mac OS X, the error here is that port 80 is not open. bash-3.2$ node fileserver.js& [2] 16020 bash-3.2$ Listening on port 80 events.js:85 throw er; // Unhandled 'error' event ^ Error: listen EACCES at exports._errnoException (util.js:746:11) at Server._listen2 (net.js:1112:19) at listen (net.js:1155:10) at Server.listen (net.js:1240:5) at EventEmitter.app.listen (/Users/cxh/src/swarmos-git/{$HOSTS_NODE}/{$ACCESSORS_MODULES}/express/lib/application.js:595:24) at Object.<anonymous> (/Users/cxh/src/swarmos-git/{$HOSTS_NODE}/fileserver.js:13:5) at Module._compile (module.js:460:26) at Object.Module._extensions..js (module.js:478:10) at Module.load (module.js:355:32) at Function.Module._load (module.js:310:12) If an error like this occurs, try changing the port number. Port 80 seems to work on Windows and port 1337 on Linux and Mac OS X. Change the port in both Run discoverhost.jsIn the node discoverhost.js Problem: Running discoverhost.js fails to find makeFromURLbash-3.2$ node discoverhost.js Run 'testST1()'' /Users/cxh/src/swarmos-git/{$HOSTS_NODE}/discoverhost.js:38 Accessor.makeFromURL(accessorURL, function(accessor) { ^ TypeError: Cannot read property 'makeFromURL' of undefined at Object.<anonymous> (/Users/cxh/src/swarmos-git/{$HOSTS_NODE}/discoverhost.js:38:9) at Module._compile (module.js:460:26) at Object.Module._extensions..js (module.js:478:10) at Module.load (module.js:355:32) at Function.Module._load (module.js:310:12) at Function.Module.runMain (module.js:501:10) at startup (node.js:129:16) at node.js:814:3 bash-3.2$ See Roll back accessor.js to get Accessor.makeFromURL() Correct operationEach device will be echoed to the screen as it is found. Then, the output of the accessor will be displayed. The accessor outputs a JSON object containing the IP, name and MAC of each device. [cxh@terra node]$ node discoverhost.js Fired Device available at 128.32.48.1 Device available at 128.32.48.21 Device available at 128.32.48.23 Device available at 128.32.48.26 Device available at 128.32.48.29 Device available at 128.32.48.31 Device available at 128.32.48.34 Device available at 128.32.48.39 Device available at 128.32.48.41 Device available at 128.32.48.42 Device available at 128.32.48.43 Device available at 128.32.48.46 ... Device available at 128.32.48.249 Device available at 128.32.48.250 Device available at 128.32.48.251 Device available at 128.32.48.77 128.32.48.1: {"name":"cory115-1-gw.EECS.Berkeley.EDU","mac":"cc:4e:24:6d:90:80"} 128.32.48.21: {"name":"cronus.CS.Berkeley.EDU","mac":"00:e0:81:5c:85:0a"} 128.32.48.23: {"name":"rhea.CS.Berkeley.EDU","mac":"00:e0:81:58:38:61"} 128.32.48.26: {"name":"dhcp-48-26.EECS.Berkeley.EDU","mac":"ec:a8:6b:f6:32:36"} 128.32.48.29: {"name":"dhcp-48-29.EECS.Berkeley.EDU","mac":"f8:b1:56:a2:22:dd"} 128.32.48.31: {"name":"dhcp-48-31.EECS.Berkeley.EDU","mac":"b8:ca:3a:b1:dc:a2"} 128.32.48.34: {"name":"dhcp-48-34.EECS.Berkeley.EDU","mac":"c8:1f:66:13:f5:fb"} 128.32.48.39: {"name":"dhcp-48-39.EECS.Berkeley.EDU","mac":"f8:b1:56:a2:25:9c"} 128.32.48.41: {"name":"dhcp-48-41.EECS.Berkeley.EDU","mac":"ec:a8:6b:f6:56:3b"} 128.32.48.42: {"name":"dhcp-48-42.EECS.Berkeley.EDU","mac":"f8:bc:12:5d:f2:77"} ... BrowserThis accessor does not run in a browser due to requiring the ping and arp commands from the OS. Swarmbox MapA swarmbox may choose to post device info to the swarmbox map hosted on terra. Note that this page is public. Any device info posted will be public. UsageA device should POST the (possibly filtered) output of the Discovery accessor to: http://terra.eecs.berkeley.edu:8088/hosts/{hostname}/devices where {hostname} is the swarmbox's name. Note this assumes each swarmbox has a unique name, which isn't true for the current set of swarmboxes, since some have "unassigned-hostname". Please assign your swarmbox a name. A GET request to the above URL will return a JSON array of devices connected to that swarmbox. Device information is not currently saved in persistent storage. ExamplesIn the Ptolemy tree under $PTII/ptolemy/actor/lib/jjs/modules/discovery/demo/Discovery,
Issues
See AlsoBack to Optional JavaScript Modules |