Created
September 29, 2016 07:01
-
-
Save yuuichi-fujioka/4ae7aa2718602c00fa54111234f25458 to your computer and use it in GitHub Desktop.
call rpc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import sys | |
from oslo_config import cfg | |
import oslo_i18n | |
from neutron.agent import rpc | |
from neutron.common import config | |
from neutron.common import rpc as n_rpc | |
from neutron.common import topics | |
from neutron import context | |
def main(ports): | |
oslo_i18n.install('neutron') | |
config.init(['--config-file', '/etc/neutron/neutron.conf', '--config-file', '/etc/neutron/plugins/ml2/ml2_conf.ini']) | |
n_rpc.init(cfg.CONF) | |
api = rpc.PluginApi(topics.PLUGIN) | |
ctxt = context.get_admin_context_without_session() | |
data = api.get_devices_details_list(ctxt,ports,None) | |
print json.dumps(data, indent=2) | |
if __name__ == '__main__': | |
main(sys.argv[1:]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment