Brocade-BSC
view release on metacpan or search on metacpan
lib/Brocade/BSC.pm view on Meta::CPAN
sub get_schema {
my $self = shift;
my ($node, $schemaId, $schemaVersion) = @_;
my $status = new Brocade::BSC::Status;
my $schema = undef;
my $urlpath = "/restconf/operations/opendaylight-inventory:nodes"
. "/node/$node/yang-ext:mount/ietf-netconf-monitoring:get-schema";
my $payload = qq({"input":{"identifier":"$schemaId","version":)
. qq("$schemaVersion","format":"yang"}});
my %headers = ('content-type'=>'application/yang.data+json',
'accept'=>'text/json, text/html, application/xml, */*');
my $resp = $self->_http_req('POST', $urlpath, $payload, \%headers);
if ($resp->code == HTTP_OK) {
my $xmltree_ref = new XML::Parser(Style => 'Tree')->parse($resp->content);
assert ($xmltree_ref->[0] eq 'get-schema');
assert ($xmltree_ref->[1][1] eq 'output');
assert ($xmltree_ref->[1][2][1] eq 'data');
assert ($xmltree_ref->[1][2][2][1] == 0);
$schema = $xmltree_ref->[1][2][2][2];
lib/Brocade/BSC.pm view on Meta::CPAN
# Parameters: node name
# Returns : BSC::Status
=cut
sub add_netconf_node {
my $self = shift;
my $node = shift;
my $status = new Brocade::BSC::Status($BSC_OK);
my $urlpath = "/restconf/config/opendaylight-inventory:nodes/node/controller-config/yang-ext:mount/config:modules";
my %headers = ('content-type' => 'application/xml',
'accept' => 'application/xml');
my $xmlPayload = <<END_XML;
<module xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
<type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">prefix:sal-netconf-connector</type>
<name>$node->{name}</name>
<address xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">$node->{ipAddr}</address>
<port xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">$node->{portNum}</port>
<username xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">$node->{adminName}</username>
<password xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">$node->{adminPassword}</password>
<tcp-only xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">$node->{tcpOnly}</tcp-only>
lib/Brocade/BSC/Node/NC/Vrouter/VR5600.pm view on Meta::CPAN
# Returns : BSC::Status - success of operation
=cut ===================================================================
sub create_firewall_instance {
my $self = shift;
my $fwInstance = shift;
my $status = new Brocade::BSC::Status($BSC_OK);
my $urlpath = $self->{ctrl}->get_ext_mount_config_urlpath($self->{name});
my %headers = ('content-type'=>'application/yang.data+json');
my $payload = $fwInstance->get_payload();
my $resp = $self->ctrl_req('POST', $urlpath, $payload, \%headers);
$resp->is_success or $status->http_err($resp);
return $status;
}
# Method ===============================================================
#
lib/Brocade/BSC/Node/NC/Vrouter/VR5600.pm view on Meta::CPAN
# firewall rules
# : inFw - name of firewall instance for inbound traffic
# : outFw - name of firewall instance for outbound traffic
# Returns : BSC::Status - success of operation
=cut ===================================================================
sub set_dataplane_interface_firewall {
my ($self, %params) = @_;
my $status = new Brocade::BSC::Status($BSC_OK);
my %headers = ('content-type' => 'application/yang.data+json');
my $urlpath = $self->{ctrl}->get_ext_mount_config_urlpath($self->{name});
$params{ifName} or die "missing req'd parameter \$ifName";
my $fw = new Brocade::BSC::Node::NC::Vrouter::VR5600::DataplaneInterfaceFirewall($params{ifName});
$params{inFw} and $fw->add_in_item($params{inFw});
$params{outFw} and $fw->add_out_item($params{outFw});
my $payload = $fw->get_payload();
$urlpath .= $fw->get_url_extension();
lib/Brocade/BSC/Node/NC/Vrouter/VR5600.pm view on Meta::CPAN
# Parameters: BSC::Node::NC::Vrouter::VPN
# Returns : BSC::Status
=cut ===================================================================
sub set_vpn_cfg {
my ($self, $vpn) = @_;
my $status = new Brocade::BSC::Status($BSC_OK);
my $urlpath = $self->{ctrl}->get_ext_mount_config_urlpath($self->{name});
my %headers = ('content-type' => 'application/yang.data+json');
my $resp = $self->ctrl_req('POST', $urlpath, $vpn->get_payload(), \%headers);
$resp->is_success or $status->http_err($resp);
return $status;
}
# Method ===============================================================
#
=item B<get_vpn_cfg>
lib/Brocade/BSC/Node/NC/Vrouter/VR5600.pm view on Meta::CPAN
#
=item B<set_openvpn_interface_cfg>
# Parameters:
# Returns :
=cut ===================================================================
sub set_openvpn_interface_cfg {
my ($self, $ovpn_ifcfg) = @_;
my $status = new Brocade::BSC::Status($BSC_OK);
my %headers = ('content-type' => 'application/yang.data+json');
my $urlpath = $self->{ctrl}->get_ext_mount_config_urlpath($self->{name});
my $resp = $self->ctrl_req('POST', $urlpath,
$ovpn_ifcfg->get_payload, \%headers);
$resp->is_success or $status->http_err($resp);
return $status;
}
# Method ===============================================================
lib/Brocade/BSC/Node/NC/Vrouter/VR5600.pm view on Meta::CPAN
# Parameters: BSC::Node::NC::Vrouter::StaticRoute to set
# Returns : BSC::Status
Configure static route on vRouter
=cut ===================================================================
sub set_protocols_static_route_cfg {
my ($self, $route) = @_;
my $status = new Brocade::BSC::Status($BSC_OK);
my %headers = ('content-type' => 'application/yang.data+json');
my $urlpath = $self->{ctrl}->get_ext_mount_config_urlpath($self->{name});
my $resp = $self->ctrl_req('POST', $urlpath,
$route->get_payload, \%headers);
$resp->is_success() or $status->http_err($resp);
return $status;
}
# Method ===============================================================
lib/Brocade/BSC/Node/OF/Switch.pm view on Meta::CPAN
# Parameters: flow_entry
# Returns : BSC::Status - success of operation
=cut ===================================================================
sub add_modify_flow {
my ($self, $flow_entry) = @_;
my $status = new Brocade::BSC::Status($BSC_OK);
if($flow_entry->isa("Brocade::BSC::Node::OF::FlowEntry")) {
my %headers = ('content-type' => 'application/yang.data+json');
my $payload = $flow_entry->get_payload();
my $urlpath = $self->{ctrl}->get_node_config_urlpath($self->{name})
. "/table/" . $flow_entry->table_id()
. "/flow/" . $flow_entry->id();
my $resp = $self->ctrl_req('PUT', $urlpath, $payload, \%headers);
($resp->code == HTTP_OK) or $status->http_err($resp);
}
else {
$status->code($BSC_MALFORMED_DATA);
( run in 4.807 seconds using v1.01-cache-2.11-cpan-524268b4103 )