Skip to content

SolarNode OSGi Shell

Matt Magoffin edited this page Aug 29, 2016 · 1 revision

SolarNode OSGi Shell

By default the SolarNode service is configured with an OSGi shell available via telnet on port 4202. To access the shell, ssh to the node, then execute

telnet localhost 4202

You should see a prompt like the following:

$ telnet localhost 4202
Trying ::1...
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
____________________________
Welcome to Apache Felix Gogo

g!

As you can see, this is the Gogo shell from the Apache Felix project. Type help for a full list of available commands.

Listing bundles

The ss (short status) command is useful for listing bundles. You can search for partial bundle names, e.g. to search for CurrentCost bundles:

g! ss currentcost
"Framework is launched."


id	State       Bundle
118	ACTIVE      net.solarnetwork.node.datum.currentcost_2.1.0
137	ACTIVE      net.solarnetwork.node.hw.currentcost_2.1.0

Uninstall bundle

Once you know the ID of a bundle, you can uninstall it from the SolarNode runtime:

g! uninstall 118

If we list currentcost bundles again, net.solarnetwork.node.datum.currentcost will be gone.

g! ss currentcost
"Framework is launched."


id	State       Bundle
137	ACTIVE      net.solarnetwork.node.hw.currentcost_2.1.0

You'd also find that if you went to the SolarNode web GUI, that plugin would no longer appear as a Component on the Settings screen.

Install bundle

You can install bundles via HTTP or local files. If you scp a plug-in to the /home/solar/app/main directory, where plug-ins should go, you can use the install command to install it. Let's re-install that CurrentCost plug-in we uninstalled above:

g! install file:///home/solar/app/main/net.solarnetwork.node.datum.currentcost-2.1.0.jar
Bundle ID: 142

Start bundle

In OSGi, installing a bundle does not also activate, or start it up. Use the start command for that, passing the ID of a bundle. Using ID 142 from the install command above, for example:

g! start 142

Once a bundle is started, any configurable Components it exports will appear on the SolarNode web GUI Settings screen.

Bundle information

The b (bundle) command is useful for showing information about a bundle, such as the services it exports and consumes:

g! b 142
net.solarnetwork.node.datum.currentcost_2.1.0 [142]
  Id=142, Status=ACTIVE      Data Root=/run/solar/org.eclipse.osgi/bundles/142/data
  "Registered Services"
    {net.solarnetwork.node.settings.SettingSpecifierProviderFactory}={org.eclipse.gemini.blueprint.bean.name=settingsFactory, org.springframework.osgi.bean.name=settingsFactory, osgi.service.blueprint.compname=settingsFactory, Bundle-SymbolicName=net.solarnetwork.node.datum.currentcost, Bundle-Version=2.1.0, service.id=177}
    {org.osgi.service.cm.ManagedServiceFactory}={service.pid=net.solarnetwork.node.datum.currentcost, service.id=178}
    {org.osgi.service.blueprint.container.BlueprintContainer}={Bundle-SymbolicName=net.solarnetwork.node.datum.currentcost, Bundle-Version=2.1.0, osgi.blueprint.container.version=2.1.0, osgi.blueprint.container.symbolicname=net.solarnetwork.node.datum.currentcost, service.id=179}
    {org.eclipse.gemini.blueprint.context.DelegatedExecutionOsgiBundleApplicationContext, org.eclipse.gemini.blueprint.context.ConfigurableOsgiBundleApplicationContext, org.springframework.context.ConfigurableApplicationContext, org.springframework.context.ApplicationContext, org.springframework.context.Lifecycle, java.io.Closeable, org.springframework.beans.factory.ListableBeanFactory, org.springframework.beans.factory.HierarchicalBeanFactory, org.springframework.context.MessageSource, org.springframework.context.ApplicationEventPublisher, org.springframework.core.io.support.ResourcePatternResolver, org.springframework.beans.factory.BeanFactory, org.springframework.core.io.ResourceLoader, java.lang.AutoCloseable, org.springframework.beans.factory.DisposableBean}={org.eclipse.gemini.blueprint.context.service.name=net.solarnetwork.node.datum.currentcost, org.springframework.context.service.name=net.solarnetwork.node.datum.currentcost, Bundle-SymbolicName=net.solarnetwork.node.datum.currentcost, Bundle-Version=2.1.0, service.id=180}
    {net.solarnetwork.node.job.ManagedTriggerAndJobDetail, net.solarnetwork.node.settings.SettingSpecifierProvider}={service.pid=net.solarnetwork.node.datum.currentcost-1470694896906-2, settingPid=net.solarnetwork.node.datum.currentcost, Bundle-SymbolicName=net.solarnetwork.node.datum.currentcost, Bundle-Version=2.1.0, service.id=181}
  Services in use:
    {org.springframework.beans.factory.xml.NamespaceHandlerResolver}={spring.osgi.core.bundle.id=30, spring.osgi.core.bundle.timestamp=1470694869890, service.id=50}
    {org.xml.sax.EntityResolver}={spring.osgi.core.bundle.id=30, spring.osgi.core.bundle.timestamp=1470694869890, service.id=51}
    {net.solarnetwork.node.io.serial.SerialNetwork, net.solarnetwork.node.settings.SettingSpecifierProvider}={service.pid=net.solarnetwork.node.io.serial-1470694896924-3, settingPid=net.solarnetwork.node.io.serial, Bundle-SymbolicName=net.solarnetwork.node.io.serial, Bundle-Version=1.1.2, service.id=171}
    {org.osgi.service.packageadmin.PackageAdmin}={service.ranking=2147483647, service.pid=0.org.eclipse.osgi.framework.internal.core.PackageAdminImpl, service.vendor=Eclipse.org - Equinox, service.id=1}
  No exported packages
  Imported packages
    net.solarnetwork.domain; version="1.9.0"<net.solarnetwork.common_1.31.0 [123]>
    net.solarnetwork.node; version="1.18.0"<net.solarnetwork.node_1.39.0 [124]>
    net.solarnetwork.node.domain; version="1.7.0"<net.solarnetwork.node_1.39.0 [124]>
    net.solarnetwork.node.hw.currentcost; version="2.1.0"<net.solarnetwork.node.hw.currentcost_2.1.0 [137]>
    net.solarnetwork.node.io.serial; version="1.0.0"<net.solarnetwork.node.io.serial_1.1.2 [128]>
    net.solarnetwork.node.job; version="1.13.1"<net.solarnetwork.node_1.39.0 [124]>
    net.solarnetwork.node.settings; version="1.7.0"<net.solarnetwork.node_1.39.0 [124]>
    net.solarnetwork.node.settings.support; version="1.5.0"<net.solarnetwork.node_1.39.0 [124]>
    net.solarnetwork.node.support; version="1.13.1"<net.solarnetwork.node_1.39.0 [124]>
    net.solarnetwork.node.util; version="1.6.0"<net.solarnetwork.node_1.39.0 [124]>
    net.solarnetwork.util; version="1.21.0"<net.solarnetwork.common_1.31.0 [123]>
    org.eclipse.gemini.blueprint.compendium.cm; version="1.0.2.RELEASE"<org.eclipse.gemini.blueprint.core_1.0.2.RELEASE [30]>
    org.quartz; version="1.6.2"<com.springsource.org.quartz_1.6.2 [46]>
    org.quartz.simpl; version="1.6.2"<com.springsource.org.quartz_1.6.2 [46]>
    org.slf4j; version="1.7.7"<slf4j.api_1.7.7 [35]>
    org.springframework.beans; version="3.2.14.RELEASE"<org.apache.servicemix.bundles.spring-beans_3.2.14.RELEASE_1 [19]>
    org.springframework.beans.factory; version="3.2.14.RELEASE"<org.apache.servicemix.bundles.spring-beans_3.2.14.RELEASE_1 [19]>
    org.springframework.beans.propertyeditors; version="3.2.14.RELEASE"<org.apache.servicemix.bundles.spring-beans_3.2.14.RELEASE_1 [19]>
    org.springframework.context; version="3.2.14.RELEASE"<org.apache.servicemix.bundles.spring-context_3.2.14.RELEASE_1 [20]>
    org.springframework.context.support; version="3.2.14.RELEASE"<org.apache.servicemix.bundles.spring-context_3.2.14.RELEASE_1 [20]>
    org.springframework.core; version="3.2.14.RELEASE"<org.apache.servicemix.bundles.spring-core_3.2.14.RELEASE_1 [22]>
    org.springframework.scheduling.quartz; version="3.2.14.RELEASE"<org.apache.servicemix.bundles.spring-context-support_3.2.14.RELEASE_1 [21]>
  No fragment bundles
  Named class space
    net.solarnetwork.node.datum.currentcost; bundle-version="2.1.0"[provided]
  No required bundles
Clone this wiki locally