1 21 22 package ist.coach.coachEmsMibComponents.LogicalInterfaceProviderComposition; 23 24 import intt.itu.itut_x780.UIDType; 25 26 import intt.itu.itut_x780.ApplicationError; 27 import intt.itu.itut_x780.AttributeValueChangeType; 28 import intt.itu.itut_x780.AttributeValueType; 29 import intt.itu.itut_x780.SourceIndicatorType; 30 import intt.itu.itut_x780.OperationalStateTypeHelper; 31 import intt.itu.itut_x780.OperationalStateType; 32 33 import ist.coach.coachEmfCommon.Utils; 34 import ist.coach.coachEmfCommon.StateChangedEventImpl; 35 import ist.coach.coachEmfCommon.StateChangedEventImpl; 36 37 import ist.coach.coachEmfCommon.ObjectDeletionImpl; 38 import ist.coach.coachEmfCommon.ExceptionMessages; 39 40 import ist.coach.coachEmfCommon.ApplicationErrorInfoTypeImpl; 41 import ist.coach.coachEmfCommon.DataTypeImpl; 42 import ist.coach.coachEmfServices.SnmpAdapter.DataType; 43 import ist.coach.coachEmfServices.SnmpAdapter.SnmpApplicationError; 44 import ist.coach.coachEmfServices.EmfBasicLog.*; 45 46 import ist.coach.coachEmsMib.LogicalInterfaceValueType; 47 import ist.coach.coachEmsMib.LogicalInterface_F; 48 import ist.coach.coachEmsMibComponents.LogicalInterfaceProviderHelper; 49 import ist.coach.coachEmsCommon.SnmpIdentifiers; 50 51 import ist.coach.coachEmsCommon.LogicalInterfaceValueTypeImpl; 52 53 import org.omg.CosNaming.NameComponent ; 54 import org.omg.CORBA.TCKind ; 55 56 import org.opennms.protocols.snmp.SnmpSMI; 57 58 import java.util.Hashtable ; 59 60 66 public class LogicalInterfaceProviderImpl 67 extends ist.coach.coachEmsMibComponents.LogicalInterfaceProviderComposition.LogicalInterfaceProvider_impl 68 { 69 77 org.omg.CORBA.ORB orb = null; 78 private String _facade_name; 79 private BasicLog logSupport; 80 81 protected static Hashtable elements; 82 private static int notifId = 11000; 83 84 protected static final String IF_TABLE_OID = SnmpIdentifiers.IF_TABLE_OID; 85 86 protected static final String IF_DESCR_OID = SnmpIdentifiers.IF_DESCR_OID; 87 protected static final String IF_TYPE_OID = SnmpIdentifiers.IF_TYPE_OID; 88 protected static final String IF_MTU_OID = SnmpIdentifiers.IF_MTU_OID; 89 protected static final String IF_SPEED_OID = SnmpIdentifiers.IF_SPEED_OID; 90 protected static final String IF_PHYSADDR_OID = SnmpIdentifiers.IF_PHYSADDR_OID; 91 protected static final String IF_ADMINSTATUS_OID = SnmpIdentifiers.IF_ADMINSTATUS_OID; 92 protected static final String IF_OPERSTATUS_OID = SnmpIdentifiers.IF_OPERSTATUS_OID; 93 protected static final String IF_LASTCHANGE_OID = SnmpIdentifiers.IF_LASTCHANGE_OID; 94 protected static final String IF_INOCTETS_OID = SnmpIdentifiers.IF_INOCTETS_OID; 95 protected static final String IF_INUCASTPKTS_OID = SnmpIdentifiers.IF_INUCASTPKTS_OID; 96 protected static final String IF_INNUCASTPKTS_OID = SnmpIdentifiers.IF_INNUCASTPKTS_OID; 97 protected static final String IF_INDISCARDS_OID = SnmpIdentifiers.IF_INDISCARDS_OID; 98 protected static final String IF_INERRORS_OID = SnmpIdentifiers.IF_INERRORS_OID; 99 protected static final String IF_INUNKNOWNPROTOS_OID = SnmpIdentifiers.IF_INUNKNOWNPROTOS_OID; 100 protected static final String IF_OUTOCTETS_OID = SnmpIdentifiers.IF_OUTOCTETS_OID; 101 protected static final String IF_OUTUCASTPKTS_OID = SnmpIdentifiers.IF_OUTUCASTPKTS_OID; 102 protected static final String IF_OUTNUCASTPKTS_OID = SnmpIdentifiers.IF_OUTNUCASTPKTS_OID; 103 protected static final String IF_OUTDISCARDS_OID = SnmpIdentifiers.IF_OUTDISCARDS_OID; 104 protected static final String IF_OUTERRORS_OID = SnmpIdentifiers.IF_OUTERRORS_OID; 105 protected static final String IF_OUTQLEN_OID = SnmpIdentifiers.IF_OUTQLEN_OID; 106 protected static final String IF_SPECIFIC_OID = SnmpIdentifiers.IF_SPECIFIC_OID; 107 108 protected static final String TIME_OID = SnmpIdentifiers.TIME_OID; 109 protected static final int COACH_LINK_UP = 2; 110 protected static final int COACH_LINK_DOWN = 3; 111 112 private static final String IF_LAST_CHANGE_PACKAGE = 113 ist.coach.coachEmsMib.conditionalPackages.ifLastChangePackageType.value; private static final String IF_ADMIN_STATUS_PACKAGE = 115 ist.coach.coachEmsMib.conditionalPackages.ifAdminStatusPackageType.value; private static final String OPERATIONAL_STATE_PACKAGE = 117 ist.coach.coachEmsMib.conditionalPackages.ifOperationalStatusPackageType.value; private static final String NON_UCAST_PACKAGE = 119 ist.coach.coachEmsMib.conditionalPackages.ifNUcastPackageType.value; private static final String UNKNOWN_PROTOS_PACKAGE = 121 ist.coach.coachEmsMib.conditionalPackages.ifUnknownProtosPackageType.value; 123 private static final String READ_COMMUNITY = SnmpIdentifiers.READ_COMMUNITY; 124 private static final String WRITE_COMMUNITY = SnmpIdentifiers.WRITE_COMMUNITY; 125 126 ist.coach.coachEmfServices.SnmpAdapter.SnmpConnector connector = null; 127 ist.coach.coachEmfServices.SnmpAdapter.SnmpTrapDaemon config = null; 128 129 137 public 138 LogicalInterfaceProviderImpl() 139 { 140 elements = new Hashtable (); 141 } 142 148 149 155 169 public void 170 configuration_complete() 171 throws org.omg.Components.InvalidConfiguration 172 { 173 177 if ((connector = get_context().get_connection_connector()) == null) 178 throw new org.omg.Components.InvalidConfiguration(); 179 180 if ((config = get_context().get_connection_config()) == null) 181 throw new org.omg.Components.InvalidConfiguration(); 182 183 if ((logSupport = get_context().get_connection_basic_log()) == null) 184 throw new org.omg.Components.InvalidConfiguration(); 185 186 orb = org.objectweb.ccm.CORBA.TheORB.getORB(); 187 System.err.println("LogicalInterface configuration completed..."); 188 189 190 } 191 200 public java.lang.String 201 facade_name() 202 { 203 return _facade_name; 207 } 208 209 212 public void 213 facade_name(java.lang.String val) 214 { 215 219 if (val != null) 220 _facade_name = new String (val); 221 } 222 228 public int 229 ifIndexGet(org.omg.CosNaming.NameComponent [] name) 230 { 231 235 237 String key = Utils.name2string(name); 238 239 if (elements.containsKey(key) == false) { 240 251 252 return -1; 253 } 254 255 LogicalInterfaceDataStructure data = 256 (LogicalInterfaceDataStructure) elements.get(key); 257 258 return data.getifIndex(); 259 } 260 261 267 public java.lang.String 268 ifDescrGet(org.omg.CosNaming.NameComponent [] name) 269 throws intt.itu.itut_x780.ApplicationError 270 { 271 275 String key = Utils.name2string(name); 276 277 if (elements.containsKey(key) == false) { 278 ApplicationErrorInfoTypeImpl error_code = 279 new ApplicationErrorInfoTypeImpl(); 280 281 error_code.error = new UIDType( 282 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 283 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 284 285 error_code.details = new String ("object with name " + 286 key + " does not exist."); 287 288 throw new ApplicationError(error_code); 289 } 290 291 LogicalInterfaceDataStructure data = 292 (LogicalInterfaceDataStructure) elements.get(key); 293 294 int ifIndex = data.getifIndex(); 295 296 String ifDescrOid = new String (IF_DESCR_OID + "." + ifIndex); 297 298 DataType ifDescrData = null; 299 300 302 try { 303 ifDescrData = connector.get( 304 ifDescrOid, 305 new String (data.getMgmtIpAddress()), 306 data.getSnmpPort(), 307 READ_COMMUNITY); 308 } 309 catch (SnmpApplicationError e) { 310 311 ApplicationErrorInfoTypeImpl error_code = 312 new ApplicationErrorInfoTypeImpl(); 313 314 error_code.error = new UIDType( 315 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 316 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 317 318 if (e.reason.equals(ExceptionMessages.agent_response_error)) 319 error_code.details = ExceptionMessages.agent_response_error; 320 else 321 error_code.details = new String ("Could not retrieve ifDescr " + 322 "for LogicalInterface Object with name " + key + ":" + 323 " Object with Snmp Object Identifier " + ifDescrOid + 324 " does not exist."); 325 326 Utils.pretty_log(logSupport, Utils.name2string(name), objectClassGet(name), 327 (short) LogSeverity._Error, 328 "SNMP Error getting ifDescr: " + e.reason); 329 throw new ApplicationError (error_code); 330 } 331 332 org.omg.CORBA.Any value = ifDescrData.value; 333 334 if (value.type().kind().value() != org.omg.CORBA.OctetSeqHelper.type().kind().value()) { 336 ApplicationErrorInfoTypeImpl error_code = 337 new ApplicationErrorInfoTypeImpl(); 338 339 error_code.error = new UIDType( 340 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 341 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 342 343 error_code.details = new String ("Could not retrieve ifDescr " + 344 "for LogicalInterface Object with name " + key + ":" + 345 " Object with Snmp Object Identifier " + ifDescrOid + 346 " is not of expected type."); 347 348 throw new ApplicationError (error_code); 349 350 } 351 String ifDescr = new String (org.omg.CORBA.OctetSeqHelper.extract(value)); 354 return ifDescr; 355 356 } 357 363 public int 364 ifTypeGet(org.omg.CosNaming.NameComponent [] name) 365 throws intt.itu.itut_x780.ApplicationError 366 { 367 371 String key = Utils.name2string(name); 372 373 if (elements.containsKey(key) == false) { 374 ApplicationErrorInfoTypeImpl error_code = 375 new ApplicationErrorInfoTypeImpl(); 376 377 error_code.error = new UIDType( 378 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 379 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 380 381 error_code.details = new String ("object with name " + 382 key + " does not exist."); 383 384 throw new ApplicationError(error_code); 385 } 386 387 LogicalInterfaceDataStructure data = 388 (LogicalInterfaceDataStructure) elements.get(key); 389 390 int ifIndex = data.getifIndex(); 391 392 String ifTypeOid = new String (IF_TYPE_OID + "." + ifIndex); 393 394 DataType ifTypeData = null; 395 396 398 try { 399 ifTypeData = connector.get( 400 ifTypeOid, 401 new String (data.getMgmtIpAddress()), 402 data.getSnmpPort(), 403 READ_COMMUNITY); 404 } 405 catch (SnmpApplicationError e) { 406 407 ApplicationErrorInfoTypeImpl error_code = 408 new ApplicationErrorInfoTypeImpl(); 409 410 error_code.error = new UIDType( 411 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 412 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 413 414 if (e.reason.equals(ExceptionMessages.agent_response_error)) 415 error_code.details = ExceptionMessages.agent_response_error; 416 else 417 error_code.details = new String ("Could not retrieve ifType " + 418 "for LogicalInterface Object with name " + key + ":" + 419 " Object with Snmp Object Identifier " + ifTypeOid + 420 " does not exist."); 421 422 Utils.pretty_log(logSupport, Utils.name2string(name), objectClassGet(name), 423 (short) LogSeverity._Error, 424 "SNMP Error getting ifType: " + e.reason); 425 throw new ApplicationError (error_code); 426 } 427 428 org.omg.CORBA.Any value = ifTypeData.value; 429 430 if (value.type().kind().value() != TCKind._tk_long) { 431 432 ApplicationErrorInfoTypeImpl error_code = 433 new ApplicationErrorInfoTypeImpl(); 434 435 error_code.error = new UIDType( 436 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 437 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 438 439 error_code.details = new String ("Could not retrieve ifType " + 440 "for LogicalInterface Object with name " + key + ":" + 441 " Object with Snmp Object Identifier " + ifTypeOid + 442 " is not of type integer, as expected."); 443 444 throw new ApplicationError (error_code); 445 446 } 447 448 int ifType = value.extract_long(); 449 450 return ifType; 451 } 452 458 public int 459 ifMtuGet(org.omg.CosNaming.NameComponent [] name) 460 throws intt.itu.itut_x780.ApplicationError 461 { 462 String key = Utils.name2string(name); 466 467 if (elements.containsKey(key) == false) { 468 ApplicationErrorInfoTypeImpl error_code = 469 new ApplicationErrorInfoTypeImpl(); 470 471 error_code.error = new UIDType( 472 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 473 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 474 475 error_code.details = new String ("object with name " + 476 key + " does not exist."); 477 478 throw new ApplicationError(error_code); 479 } 480 481 LogicalInterfaceDataStructure data = 482 (LogicalInterfaceDataStructure) elements.get(key); 483 484 int ifIndex = data.getifIndex(); 485 486 String ifMtuOid = new String (IF_MTU_OID + "." + ifIndex); 487 488 DataType ifMtuData = null; 489 490 492 try { 493 494 ifMtuData = connector.get( 495 ifMtuOid, 496 new String (data.getMgmtIpAddress()), 497 data.getSnmpPort(), 498 READ_COMMUNITY); 499 } 500 catch (SnmpApplicationError e) { 501 502 ApplicationErrorInfoTypeImpl error_code = 503 new ApplicationErrorInfoTypeImpl(); 504 505 error_code.error = new UIDType( 506 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 507 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 508 509 if (e.reason.equals(ExceptionMessages.agent_response_error)) 510 error_code.details = ExceptionMessages.agent_response_error; 511 else 512 error_code.details = new String ("Could not retrieve ifMtu " + 513 "for LogicalInterface Object with name " + key + ":" + 514 " Object with Snmp Object Identifier " + ifMtuOid + 515 " does not exist."); 516 517 Utils.pretty_log(logSupport, Utils.name2string(name), objectClassGet(name), 518 (short) LogSeverity._Error, 519 "SNMP Error getting ifMtu: " + e.reason); 520 throw new ApplicationError (error_code); 521 } 522 523 org.omg.CORBA.Any value = ifMtuData.value; 524 525 if (value.type().kind().value() != TCKind._tk_long) { 526 527 ApplicationErrorInfoTypeImpl error_code = 528 new ApplicationErrorInfoTypeImpl(); 529 530 error_code.error = new UIDType( 531 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 532 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 533 534 error_code.details = new String ("Could not retrieve ifMtu " + 535 "for LogicalInterface Object with name " + key + ":" + 536 " Object with Snmp Object Identifier " + ifMtuOid + 537 " is not of type integer, as expected."); 538 539 throw new ApplicationError (error_code); 540 541 } 542 543 int ifMtu = value.extract_long(); 544 545 return ifMtu; 546 } 547 553 public long 554 ifSpeedGet(org.omg.CosNaming.NameComponent [] name) 555 throws intt.itu.itut_x780.ApplicationError 556 { 557 String key = Utils.name2string(name); 561 562 if (elements.containsKey(key) == false) { 563 ApplicationErrorInfoTypeImpl error_code = 564 new ApplicationErrorInfoTypeImpl(); 565 566 error_code.error = new UIDType( 567 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 568 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 569 570 error_code.details = new String ("object with name " + 571 key + " does not exist."); 572 573 throw new ApplicationError(error_code); 574 } 575 576 LogicalInterfaceDataStructure data = 577 (LogicalInterfaceDataStructure) elements.get(key); 578 579 int ifIndex = data.getifIndex(); 580 581 String ifSpeedOid = new String (IF_SPEED_OID + "." + ifIndex); 582 583 DataType ifSpeedData = null; 584 585 587 try { 588 ifSpeedData = connector.get( 589 ifSpeedOid, 590 new String (data.getMgmtIpAddress()), 591 data.getSnmpPort(), 592 READ_COMMUNITY); 593 } 594 catch (SnmpApplicationError e) { 595 596 ApplicationErrorInfoTypeImpl error_code = 597 new ApplicationErrorInfoTypeImpl(); 598 599 error_code.error = new UIDType( 600 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 601 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 602 603 if (e.reason.equals(ExceptionMessages.agent_response_error)) 604 error_code.details = ExceptionMessages.agent_response_error; 605 else 606 error_code.details = new String ("Could not retrieve ifSpeed " + 607 "for LogicalInterface Object with name " + key + ":" + 608 " Object with Snmp Object Identifier " + ifSpeedOid + 609 " does not exist."); 610 611 Utils.pretty_log(logSupport, Utils.name2string(name), objectClassGet(name), 612 (short) LogSeverity._Error, 613 "SNMP Error getting ifSpeed: " + e.reason); 614 throw new ApplicationError (error_code); 615 } 616 617 org.omg.CORBA.Any value = ifSpeedData.value; 618 619 if (value.type().kind().value() != TCKind._tk_longlong) { 620 621 ApplicationErrorInfoTypeImpl error_code = 622 new ApplicationErrorInfoTypeImpl(); 623 624 error_code.error = new UIDType( 625 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 626 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 627 628 error_code.details = new String ("Could not retrieve ifSpeed " + 629 "for LogicalInterface Object with name " + key + ":" + 630 " Object with Snmp Object Identifier " + ifSpeedOid + 631 " is not of type integer, as expected."); 632 633 throw new ApplicationError (error_code); 634 635 } 636 637 long ifSpeed = value.extract_longlong(); 638 639 return ifSpeed; 640 } 641 647 public byte[] 648 ifPhysAddressGet(org.omg.CosNaming.NameComponent [] name) 649 throws intt.itu.itut_x780.ApplicationError 650 { 651 String key = Utils.name2string(name); 655 656 if (elements.containsKey(key) == false) { 657 ApplicationErrorInfoTypeImpl error_code = 658 new ApplicationErrorInfoTypeImpl(); 659 660 error_code.error = new UIDType( 661 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 662 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 663 664 error_code.details = new String ("object with name " + 665 key + " does not exist."); 666 667 throw new ApplicationError(error_code); 668 } 669 670 LogicalInterfaceDataStructure data = 671 (LogicalInterfaceDataStructure) elements.get(key); 672 673 int ifIndex = data.getifIndex(); 674 675 String ifPhysAddrOid = new String (IF_PHYSADDR_OID + "." + ifIndex); 676 677 DataType ifPhysAddrData = null; 678 679 681 try { 682 ifPhysAddrData = connector.get( 683 ifPhysAddrOid, 684 new String (data.getMgmtIpAddress()), 685 data.getSnmpPort(), 686 READ_COMMUNITY); 687 } 688 catch (SnmpApplicationError e) { 689 690 ApplicationErrorInfoTypeImpl error_code = 691 new ApplicationErrorInfoTypeImpl(); 692 693 error_code.error = new UIDType( 694 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 695 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 696 697 if (e.reason.equals(ExceptionMessages.agent_response_error)) 698 error_code.details = ExceptionMessages.agent_response_error; 699 else 700 error_code.details = new String ("Could not retrieve ifPhysAddr " + 701 "for LogicalInterface Object with name " + key + ":" + 702 " Object with Snmp Object Identifier " + ifPhysAddrOid + 703 " does not exist."); 704 705 Utils.pretty_log(logSupport, Utils.name2string(name), objectClassGet(name), 706 (short) LogSeverity._Error, 707 "SNMP Error getting ifPhysAddr: " + e.reason); 708 throw new ApplicationError (error_code); 709 } 710 711 org.omg.CORBA.Any value = ifPhysAddrData.value; 712 713 if (value.type().kind().value() != org.omg.CORBA.OctetSeqHelper.type().kind().value()) { 715 ApplicationErrorInfoTypeImpl error_code = 716 new ApplicationErrorInfoTypeImpl(); 717 718 error_code.error = new UIDType( 719 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 720 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 721 722 error_code.details = new String ("Could not retrieve ifPhysAddr " + 723 "for LogicalInterface Object with name " + key + ":" + 724 " Object with Snmp Object Identifier " + ifPhysAddrOid + 725 " is not of expected type."); 726 727 throw new ApplicationError (error_code); 728 729 } 730 734 byte [] ifPhysAddr = org.omg.CORBA.OctetSeqHelper.extract(value); 735 return ifPhysAddr; 736 } 737 743 public int 744 ifAdminStatusGet(org.omg.CosNaming.NameComponent [] name) 745 throws intt.itu.itut_x780.ApplicationError 746 { 747 String key = Utils.name2string(name); 751 752 if (elements.containsKey(key) == false) { 753 ApplicationErrorInfoTypeImpl error_code = 754 new ApplicationErrorInfoTypeImpl(); 755 756 error_code.error = new UIDType( 757 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 758 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 759 760 error_code.details = new String ("object with name " + 761 key + " does not exist."); 762 763 throw new ApplicationError(error_code); 764 } 765 766 LogicalInterfaceDataStructure data = 767 (LogicalInterfaceDataStructure) elements.get(key); 768 769 int ifIndex = data.getifIndex(); 770 771 String ifAdminStatusOid = new String (IF_ADMINSTATUS_OID + "." + ifIndex); 772 773 DataType ifAdminStatusData = null; 774 775 777 try { 778 ifAdminStatusData = connector.get( 779 ifAdminStatusOid, 780 new String (data.getMgmtIpAddress()), 781 data.getSnmpPort(), 782 READ_COMMUNITY); 783 } 784 catch (SnmpApplicationError e) { 785 786 ApplicationErrorInfoTypeImpl error_code = 787 new ApplicationErrorInfoTypeImpl(); 788 789 error_code.error = new UIDType( 790 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 791 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 792 793 if (e.reason.equals(ExceptionMessages.agent_response_error)) 794 error_code.details = ExceptionMessages.agent_response_error; 795 else 796 error_code.details = new String ("Could not retrieve ifAdminStatus " + 797 "for LogicalInterface Object with name " + key + ":" + 798 " Object with Snmp Object Identifier " + ifAdminStatusOid + 799 " does not exist."); 800 801 Utils.pretty_log(logSupport, Utils.name2string(name), objectClassGet(name), 802 (short) LogSeverity._Error, 803 "SNMP Error getting ifAdminStatus: " + e.reason); 804 throw new ApplicationError (error_code); 805 } 806 807 org.omg.CORBA.Any value = ifAdminStatusData.value; 808 809 if (value.type().kind().value() != TCKind._tk_long) { 810 811 ApplicationErrorInfoTypeImpl error_code = 812 new ApplicationErrorInfoTypeImpl(); 813 814 error_code.error = new UIDType( 815 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 816 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 817 818 error_code.details = new String ("Could not retrieve ifAdminStatus " + 819 "for LogicalInterface Object with name " + key + ":" + 820 " Object with Snmp Object Identifier " + ifAdminStatusOid + 821 " is not of type integer, as expected."); 822 823 throw new ApplicationError (error_code); 824 825 } 826 827 int ifAdminStatus = value.extract_long(); 828 829 return ifAdminStatus; 830 } 831 837 public void 838 ifAdminStatusSet(org.omg.CosNaming.NameComponent [] name, int ifAdminStatus) 839 throws intt.itu.itut_x780.ApplicationError, ist.coach.coachEmsMib.NOifAdminStatusPackageException 840 { 841 String key = Utils.name2string(name); 845 846 if (elements.containsKey(key) == false) { 847 ApplicationErrorInfoTypeImpl error_code = 848 new ApplicationErrorInfoTypeImpl(); 849 850 error_code.error = new UIDType( 851 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 852 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 853 854 error_code.details = new String ("object with name " + 855 key + " does not exist."); 856 857 throw new ApplicationError(error_code); 858 } 859 860 if (!Utils.packageIsSupported(IF_ADMIN_STATUS_PACKAGE, 861 packagesGet(name))) { 862 throw new ist.coach.coachEmsMib.NOifAdminStatusPackageException(); 863 } 864 865 LogicalInterfaceDataStructure data = 866 (LogicalInterfaceDataStructure) elements.get(key); 867 868 int ifIndex = data.getifIndex(); 869 String ifAdminStatusOid = new String (IF_DESCR_OID + "." + ifIndex); 870 871 org.omg.CORBA.Any value = orb.create_any(); 872 value.insert_long(ifAdminStatus); 873 DataTypeImpl ifAdminStatusData = new DataTypeImpl( 874 ifAdminStatusOid, 875 value, 876 SnmpSMI.SMI_INTEGER); 877 878 880 try { 881 connector.set( 882 ifAdminStatusData, 883 new String (data.getMgmtIpAddress()), 884 data.getSnmpPort(), 885 WRITE_COMMUNITY); 886 } 887 catch (SnmpApplicationError e) { 888 889 ApplicationErrorInfoTypeImpl error_code = 890 new ApplicationErrorInfoTypeImpl(); 891 892 error_code.error = new UIDType( 893 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 894 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 895 896 if (e.reason.equals(ExceptionMessages.agent_response_error)) 897 error_code.details = ExceptionMessages.agent_response_error; 898 else 899 error_code.details = new String ("Could not set ifAdminStatus " + 900 "for LogicalInterface Object with name " + key + "."); 901 902 Utils.pretty_log(logSupport, Utils.name2string(name), objectClassGet(name), 903 (short) LogSeverity._Error, 904 "SNMP Error setting ifAdminStatus: " + e.reason); 905 throw new ApplicationError (error_code); 906 } 907 908 } 909 915 public int 916 ifOperStatusGet(org.omg.CosNaming.NameComponent [] name) 917 throws intt.itu.itut_x780.ApplicationError 918 { 919 String key = Utils.name2string(name); 923 924 if (elements.containsKey(key) == false) { 925 ApplicationErrorInfoTypeImpl error_code = 926 new ApplicationErrorInfoTypeImpl(); 927 928 error_code.error = new UIDType( 929 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 930 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 931 932 error_code.details = new String ("object with name " + 933 key + " does not exist."); 934 935 throw new ApplicationError(error_code); 936 } 937 938 LogicalInterfaceDataStructure data = 939 (LogicalInterfaceDataStructure) elements.get(key); 940 941 int ifIndex = data.getifIndex(); 942 943 String ifOperStatusOid = new String (IF_OPERSTATUS_OID + "." + ifIndex); 944 945 DataType ifOperStatusData = null; 946 947 949 try { 950 ifOperStatusData = connector.get( 951 ifOperStatusOid, 952 new String (data.getMgmtIpAddress()), 953 data.getSnmpPort(), 954 READ_COMMUNITY); 955 } 956 catch (SnmpApplicationError e) { 957 958 ApplicationErrorInfoTypeImpl error_code = 959 new ApplicationErrorInfoTypeImpl(); 960 961 error_code.error = new UIDType( 962 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 963 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 964 965 if (e.reason.equals(ExceptionMessages.agent_response_error)) 966 error_code.details = ExceptionMessages.agent_response_error; 967 else 968 error_code.details = new String ("Could not retrieve ifOperStatus " + 969 "for LogicalInterface Object with name " + key + ":" + 970 " Object with Snmp Object Identifier " + ifOperStatusOid + 971 " does not exist."); 972 Utils.pretty_log(logSupport, Utils.name2string(name), objectClassGet(name), 973 (short) LogSeverity._Error, 974 "SNMP Error getting ifOperStatus: " + e.reason); 975 976 throw new ApplicationError (error_code); 977 } 978 979 org.omg.CORBA.Any value = ifOperStatusData.value; 980 981 if (value.type().kind().value() != TCKind._tk_long) { 982 983 ApplicationErrorInfoTypeImpl error_code = 984 new ApplicationErrorInfoTypeImpl(); 985 986 error_code.error = new UIDType( 987 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 988 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 989 990 error_code.details = new String ("Could not retrieve ifOperStatus " + 991 "for LogicalInterface Object with name " + key + ":" + 992 " Object with Snmp Object Identifier " + ifOperStatusOid + 993 " is not of type integer, as expected."); 994 995 throw new ApplicationError (error_code); 996 997 } 998 999 int ifOperStatus = value.extract_long(); 1000 1001 return ifOperStatus; 1002 } 1003 1009 public long 1010 ifLastChangeGet(org.omg.CosNaming.NameComponent [] name) 1011 throws intt.itu.itut_x780.ApplicationError, ist.coach.coachEmsMib.NOifLastChangePackageException 1012 { 1013 1017 String key = Utils.name2string(name); 1018 1019 if (elements.containsKey(key) == false) { 1020 ApplicationErrorInfoTypeImpl error_code = 1021 new ApplicationErrorInfoTypeImpl(); 1022 1023 error_code.error = new UIDType( 1024 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 1025 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 1026 1027 error_code.details = new String ("object with name " + 1028 key + " does not exist."); 1029 1030 throw new ApplicationError(error_code); 1031 } 1032 1033 if (!Utils.packageIsSupported(IF_LAST_CHANGE_PACKAGE, 1034 packagesGet(name))) { 1035 throw new ist.coach.coachEmsMib.NOifLastChangePackageException(); 1036 } 1037 1038 LogicalInterfaceDataStructure data = 1039 (LogicalInterfaceDataStructure) elements.get(key); 1040 1041 int ifIndex = data.getifIndex(); 1042 1043 String ifLastChangeOid = new String (IF_LASTCHANGE_OID + "." + ifIndex); 1044 1045 DataType ifLastChangeData = null; 1046 1047 1049 try { 1050 ifLastChangeData = connector.get( 1051 ifLastChangeOid, 1052 new String (data.getMgmtIpAddress()), 1053 data.getSnmpPort(), 1054 READ_COMMUNITY); 1055 } 1056 catch (SnmpApplicationError e) { 1057 1058 ApplicationErrorInfoTypeImpl error_code = 1059 new ApplicationErrorInfoTypeImpl(); 1060 1061 error_code.error = new UIDType( 1062 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 1063 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 1064 1065 if (e.reason.equals(ExceptionMessages.agent_response_error)) 1066 error_code.details = ExceptionMessages.agent_response_error; 1067 else 1068 error_code.details = new String ("Could not retrieve ifLastChange " + 1069 "for LogicalInterface Object with name " + key + ":" + 1070 " Object with Snmp Object Identifier " + ifLastChangeOid + 1071 " does not exist."); 1072 Utils.pretty_log(logSupport, Utils.name2string(name), objectClassGet(name), 1073 (short) LogSeverity._Error, 1074 "SNMP Error getting ifLastChange: " + e.reason); 1075 1076 throw new ApplicationError (error_code); 1077 } 1078 1079 org.omg.CORBA.Any value = ifLastChangeData.value; 1080 1081 if (value.type().kind().value() != TCKind._tk_longlong) { 1082 1083 ApplicationErrorInfoTypeImpl error_code = 1084 new ApplicationErrorInfoTypeImpl(); 1085 1086 error_code.error = new UIDType( 1087 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 1088 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 1089 1090 error_code.details = new String ("Could not retrieve ifLastChange " + 1091 "for LogicalInterface Object with name " + key + ":" + 1092 " Object with Snmp Object Identifier " + ifLastChangeOid + 1093 " is not of type string, as expected."); 1094 1095 throw new ApplicationError (error_code); 1096 1097 } 1098 1099 long ifLastChange = value.extract_longlong(); 1100 1101 return ifLastChange; 1102 } 1103 1104 1110 public long 1111 ifInOctetsGet(org.omg.CosNaming.NameComponent [] name) 1112 throws intt.itu.itut_x780.ApplicationError 1113 { 1114 String key = Utils.name2string(name); 1118 1119 if (elements.containsKey(key) == false) { 1120 ApplicationErrorInfoTypeImpl error_code = 1121 new ApplicationErrorInfoTypeImpl(); 1122 1123 error_code.error = new UIDType( 1124 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 1125 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 1126 1127 error_code.details = new String ("object with name " + 1128 key + " does not exist."); 1129 1130 throw new ApplicationError(error_code); 1131 } 1132 1133 LogicalInterfaceDataStructure data = 1134 (LogicalInterfaceDataStructure) elements.get(key); 1135 1136 int ifIndex = data.getifIndex(); 1137 1138 String ifInOctetsOid = new String (IF_INOCTETS_OID + "." + ifIndex); 1139 1140 DataType ifInOctetsData = null; 1141 1142 1144 try { 1145 ifInOctetsData = connector.get( 1146 ifInOctetsOid, 1147 new String (data.getMgmtIpAddress()), 1148 data.getSnmpPort(), 1149 READ_COMMUNITY); 1150 } 1151 catch (SnmpApplicationError e) { 1152 1153 ApplicationErrorInfoTypeImpl error_code = 1154 new ApplicationErrorInfoTypeImpl(); 1155 1156 error_code.error = new UIDType( 1157 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 1158 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 1159 1160 if (e.reason.equals(ExceptionMessages.agent_response_error)) 1161 error_code.details = ExceptionMessages.agent_response_error; 1162 else 1163 error_code.details = new String ("Could not retrieve ifInOctets " + 1164 "for LogicalInterface Object with name " + key + ":" + 1165 " Object with Snmp Object Identifier " + ifInOctetsOid + 1166 " does not exist."); 1167 1168 Utils.pretty_log(logSupport, Utils.name2string(name), objectClassGet(name), 1169 (short) LogSeverity._Error, 1170 "SNMP Error getting ifInOctets: " + e.reason); 1171 throw new ApplicationError (error_code); 1172 } 1173 1174 org.omg.CORBA.Any value = ifInOctetsData.value; 1175 1176 if (value.type().kind().value() != TCKind._tk_longlong) { 1177 1178 ApplicationErrorInfoTypeImpl error_code = 1179 new ApplicationErrorInfoTypeImpl(); 1180 1181 error_code.error = new UIDType( 1182 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 1183 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 1184 1185 error_code.details = new String ("Could not retrieve ifInOctets " + 1186 "for LogicalInterface Object with name " + key + ":" + 1187 " Object with Snmp Object Identifier " + ifInOctetsOid + 1188 " is not of type integer, as expected."); 1189 1190 throw new ApplicationError (error_code); 1191 1192 } 1193 1194 long ifInOctets = value.extract_longlong(); 1195 1196 return ifInOctets; 1197 } 1198 1204 public long 1205 ifInUcastPktsGet(org.omg.CosNaming.NameComponent [] name) 1206 throws intt.itu.itut_x780.ApplicationError 1207 { 1208 String key = Utils.name2string(name); 1212 1213 if (elements.containsKey(key) == false) { 1214 ApplicationErrorInfoTypeImpl error_code = 1215 new ApplicationErrorInfoTypeImpl(); 1216 1217 error_code.error = new UIDType( 1218 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 1219 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 1220 1221 error_code.details = new String ("object with name " + 1222 key + " does not exist."); 1223 1224 throw new ApplicationError(error_code); 1225 } 1226 1227 LogicalInterfaceDataStructure data = 1228 (LogicalInterfaceDataStructure) elements.get(key); 1229 1230 int ifIndex = data.getifIndex(); 1231 1232 String ifInUcastPktsOid = new String (IF_INUCASTPKTS_OID + "." + ifIndex); 1233 1234 DataType ifInUcastPktsData = null; 1235 1236 1238 try { 1239 ifInUcastPktsData = connector.get( 1240 ifInUcastPktsOid, 1241 new String (data.getMgmtIpAddress()), 1242 data.getSnmpPort(), 1243 READ_COMMUNITY); 1244 } 1245 catch (SnmpApplicationError e) { 1246 1247 ApplicationErrorInfoTypeImpl error_code = 1248 new ApplicationErrorInfoTypeImpl(); 1249 1250 error_code.error = new UIDType( 1251 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 1252 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 1253 1254 if (e.reason.equals(ExceptionMessages.agent_response_error)) 1255 error_code.details = ExceptionMessages.agent_response_error; 1256 else 1257 error_code.details = new String ("Could not retrieve ifInUcastPkts " + 1258 "for LogicalInterface Object with name " + key + ":" + 1259 " Object with Snmp Object Identifier " + ifInUcastPktsOid + 1260 " does not exist."); 1261 1262 Utils.pretty_log(logSupport, Utils.name2string(name), objectClassGet(name), 1263 (short) LogSeverity._Error, 1264 "SNMP Error getting ifInUcastPkts: " + e.reason); 1265 throw new ApplicationError (error_code); 1266 } 1267 1268 org.omg.CORBA.Any value = ifInUcastPktsData.value; 1269 1270 if (value.type().kind().value() != TCKind._tk_longlong) { 1271 1272 ApplicationErrorInfoTypeImpl error_code = 1273 new ApplicationErrorInfoTypeImpl(); 1274 1275 error_code.error = new UIDType( 1276 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 1277 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 1278 1279 error_code.details = new String ("Could not retrieve ifInUcastPkts " + 1280 "for LogicalInterface Object with name " + key + ":" + 1281 " Object with Snmp Object Identifier " + ifInUcastPktsOid + 1282 " is not of type integer, as expected."); 1283 1284 throw new ApplicationError (error_code); 1285 1286 } 1287 1288 long ifInUcastPkts = value.extract_longlong(); 1289 1290 return ifInUcastPkts; 1291 } 1292 1298 public long 1299 ifInNUcastPktsGet(org.omg.CosNaming.NameComponent [] name) 1300 throws intt.itu.itut_x780.ApplicationError, ist.coach.coachEmsMib.NOnonUcastPackageException 1301 { 1302 String key = Utils.name2string(name); 1306 1307 if (elements.containsKey(key) == false) { 1308 ApplicationErrorInfoTypeImpl error_code = 1309 new ApplicationErrorInfoTypeImpl(); 1310 1311 error_code.error = new UIDType( 1312 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 1313 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 1314 1315 error_code.details = new String ("object with name " + 1316 key + " does not exist."); 1317 1318 throw new ApplicationError(error_code); 1319 } 1320 1321 if (!Utils.packageIsSupported(NON_UCAST_PACKAGE, 1322 packagesGet(name))) { 1323 throw new ist.coach.coachEmsMib.NOnonUcastPackageException(); 1324 } 1325 1326 LogicalInterfaceDataStructure data = 1327 (LogicalInterfaceDataStructure) elements.get(key); 1328 1329 int ifIndex = data.getifIndex(); 1330 1331 String ifInNUcastPktsOid = new String (IF_INNUCASTPKTS_OID + "." + ifIndex); 1332 1333 DataType ifInNUcastPktsData = null; 1334 1335 1337 try { 1338 ifInNUcastPktsData = connector.get( 1339 ifInNUcastPktsOid, 1340 new String (data.getMgmtIpAddress()), 1341 data.getSnmpPort(), 1342 READ_COMMUNITY); 1343 } 1344 catch (SnmpApplicationError e) { 1345 1346 ApplicationErrorInfoTypeImpl error_code = 1347 new ApplicationErrorInfoTypeImpl(); 1348 1349 error_code.error = new UIDType( 1350 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 1351 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 1352 1353 if (e.reason.equals(ExceptionMessages.agent_response_error)) 1354 error_code.details = ExceptionMessages.agent_response_error; 1355 else 1356 error_code.details = new String ("Could not retrieve ifInNUcastPkts " + 1357 "for LogicalInterface Object with name " + key + ":" + 1358 " Object with Snmp Object Identifier " + ifInNUcastPktsOid + 1359 " does not exist."); 1360 1361 Utils.pretty_log(logSupport, Utils.name2string(name), objectClassGet(name), 1362 (short) LogSeverity._Error, 1363 "SNMP Error getting ifInNUcastPkts: " + e.reason); 1364 throw new ApplicationError (error_code); 1365 } 1366 1367 org.omg.CORBA.Any value = ifInNUcastPktsData.value; 1368 1369 if (value.type().kind().value() != TCKind._tk_longlong) { 1370 1371 ApplicationErrorInfoTypeImpl error_code = 1372 new ApplicationErrorInfoTypeImpl(); 1373 1374 error_code.error = new UIDType( 1375 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 1376 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 1377 1378 error_code.details = new String ("Could not retrieve ifInNUcastPkts " + 1379 "for LogicalInterface Object with name " + key + ":" + 1380 " Object with Snmp Object Identifier " + ifInNUcastPktsOid + 1381 " is not of type integer, as expected."); 1382 1383 throw new ApplicationError (error_code); 1384 1385 } 1386 1387 long ifInNUcastPkts = value.extract_longlong(); 1388 1389 return ifInNUcastPkts; 1390 } 1391 1397 public long 1398 ifInDiscardsGet(org.omg.CosNaming.NameComponent [] name) 1399 throws intt.itu.itut_x780.ApplicationError 1400 { 1401 String key = Utils.name2string(name); 1405 1406 if (elements.containsKey(key) == false) { 1407 ApplicationErrorInfoTypeImpl error_code = 1408 new ApplicationErrorInfoTypeImpl(); 1409 1410 error_code.error = new UIDType( 1411 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 1412 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 1413 1414 error_code.details = new String ("object with name " + 1415 key + " does not exist."); 1416 1417 throw new ApplicationError(error_code); 1418 } 1419 1420 LogicalInterfaceDataStructure data = 1421 (LogicalInterfaceDataStructure) elements.get(key); 1422 1423 int ifIndex = data.getifIndex(); 1424 1425 String ifInDiscardsOid = new String (IF_INDISCARDS_OID + "." + ifIndex); 1426 1427 DataType ifInDiscardsData = null; 1428 1429 1431 try { 1432 ifInDiscardsData = connector.get( 1433 ifInDiscardsOid, 1434 new String (data.getMgmtIpAddress()), 1435 data.getSnmpPort(), 1436 READ_COMMUNITY); 1437 } 1438 catch (SnmpApplicationError e) { 1439 1440 ApplicationErrorInfoTypeImpl error_code = 1441 new ApplicationErrorInfoTypeImpl(); 1442 1443 error_code.error = new UIDType( 1444 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 1445 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 1446 1447 if (e.reason.equals(ExceptionMessages.agent_response_error)) 1448 error_code.details = ExceptionMessages.agent_response_error; 1449 else 1450 error_code.details = new String ("Could not retrieve ifInDiscards " + 1451 "for LogicalInterface Object with name " + key + ":" + 1452 " Object with Snmp Object Identifier " + ifInDiscardsOid + 1453 " does not exist."); 1454 1455 Utils.pretty_log(logSupport, Utils.name2string(name), objectClassGet(name), 1456 (short) LogSeverity._Error, 1457 "SNMP Error getting ifInDiscards: " + e.reason); 1458 throw new ApplicationError (error_code); 1459 } 1460 1461 org.omg.CORBA.Any value = ifInDiscardsData.value; 1462 1463 if (value.type().kind().value() != TCKind._tk_longlong) { 1464 1465 ApplicationErrorInfoTypeImpl error_code = 1466 new ApplicationErrorInfoTypeImpl(); 1467 1468 error_code.error = new UIDType( 1469 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 1470 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 1471 1472 error_code.details = new String ("Could not retrieve ifInDiscards " + 1473 "for LogicalInterface Object with name " + key + ":" + 1474 " Object with Snmp Object Identifier " + ifInDiscardsOid + 1475 " is not of type integer, as expected."); 1476 1477 throw new ApplicationError (error_code); 1478 1479 } 1480 1481 long ifInDiscards = value.extract_longlong(); 1482 1483 return ifInDiscards; 1484 } 1485 1491 public long 1492 ifInErrorsGet(org.omg.CosNaming.NameComponent [] name) 1493 throws intt.itu.itut_x780.ApplicationError 1494 { 1495 String key = Utils.name2string(name); 1499 1500 if (elements.containsKey(key) == false) { 1501 ApplicationErrorInfoTypeImpl error_code = 1502 new ApplicationErrorInfoTypeImpl(); 1503 1504 error_code.error = new UIDType( 1505 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 1506 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 1507 1508 error_code.details = new String ("object with name " + 1509 key + " does not exist."); 1510 1511 throw new ApplicationError(error_code); 1512 } 1513 1514 LogicalInterfaceDataStructure data = 1515 (LogicalInterfaceDataStructure) elements.get(key); 1516 1517 int ifIndex = data.getifIndex(); 1518 1519 String ifInErrorsOid = new String (IF_INERRORS_OID + "." + ifIndex); 1520 1521 DataType ifInErrorsData = null; 1522 1523 1525 try { 1526 ifInErrorsData = connector.get( 1527 ifInErrorsOid, 1528 new String (data.getMgmtIpAddress()), 1529 data.getSnmpPort(), 1530 READ_COMMUNITY); 1531 } 1532 catch (SnmpApplicationError e) { 1533 1534 ApplicationErrorInfoTypeImpl error_code = 1535 new ApplicationErrorInfoTypeImpl(); 1536 1537 error_code.error = new UIDType( 1538 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 1539 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 1540 1541 if (e.reason.equals(ExceptionMessages.agent_response_error)) 1542 error_code.details = ExceptionMessages.agent_response_error; 1543 else 1544 error_code.details = new String ("Could not retrieve ifInErrors " + 1545 "for LogicalInterface Object with name " + key + ":" + 1546 " Object with Snmp Object Identifier " + ifInErrorsOid + 1547 " does not exist."); 1548 1549 Utils.pretty_log(logSupport, Utils.name2string(name), objectClassGet(name), 1550 (short) LogSeverity._Error, 1551 "SNMP Error getting ifInErrors: " + e.reason); 1552 throw new ApplicationError (error_code); 1553 } 1554 1555 org.omg.CORBA.Any value = ifInErrorsData.value; 1556 1557 if (value.type().kind().value() != TCKind._tk_longlong) { 1558 1559 ApplicationErrorInfoTypeImpl error_code = 1560 new ApplicationErrorInfoTypeImpl(); 1561 1562 error_code.error = new UIDType( 1563 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 1564 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 1565 1566 error_code.details = new String ("Could not retrieve ifInErrors " + 1567 "for LogicalInterface Object with name " + key + ":" + 1568 " Object with Snmp Object Identifier " + ifInErrorsOid + 1569 " is not of type integer, as expected."); 1570 1571 throw new ApplicationError (error_code); 1572 1573 } 1574 1575 long ifInErrors = value.extract_longlong(); 1576 1577 return ifInErrors; 1578 } 1579 1585 public long 1586 ifInUnknownProtosGet(org.omg.CosNaming.NameComponent [] name) 1587 throws intt.itu.itut_x780.ApplicationError, ist.coach.coachEmsMib.NOunknownProtosPackageException 1588 { 1589 String key = Utils.name2string(name); 1593 1594 if (elements.containsKey(key) == false) { 1595 ApplicationErrorInfoTypeImpl error_code = 1596 new ApplicationErrorInfoTypeImpl(); 1597 1598 error_code.error = new UIDType( 1599 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 1600 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 1601 1602 error_code.details = new String ("object with name " + 1603 key + " does not exist."); 1604 1605 throw new ApplicationError(error_code); 1606 } 1607 1608 if (!Utils.packageIsSupported(UNKNOWN_PROTOS_PACKAGE, 1609 packagesGet(name))) { 1610 throw new ist.coach.coachEmsMib.NOunknownProtosPackageException(); 1611 } 1612 1613 LogicalInterfaceDataStructure data = 1614 (LogicalInterfaceDataStructure) elements.get(key); 1615 1616 int ifIndex = data.getifIndex(); 1617 1618 String ifInUnknownProtosOid = new String (IF_INUNKNOWNPROTOS_OID + "." + ifIndex); 1619 1620 DataType ifInUnknownProtosData = null; 1621 1622 1624 try { 1625 ifInUnknownProtosData = connector.get( 1626 ifInUnknownProtosOid, 1627 new String (data.getMgmtIpAddress()), 1628 data.getSnmpPort(), 1629 READ_COMMUNITY); 1630 } 1631 catch (SnmpApplicationError e) { 1632 1633 ApplicationErrorInfoTypeImpl error_code = 1634 new ApplicationErrorInfoTypeImpl(); 1635 1636 error_code.error = new UIDType( 1637 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 1638 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 1639 1640 if (e.reason.equals(ExceptionMessages.agent_response_error)) 1641 error_code.details = ExceptionMessages.agent_response_error; 1642 else 1643 error_code.details = new String ("Could not retrieve ifInUnknownProtos " + 1644 "for LogicalInterface Object with name " + key + ":" + 1645 " Object with Snmp Object Identifier " + ifInUnknownProtosOid + 1646 " does not exist."); 1647 1648 Utils.pretty_log(logSupport, Utils.name2string(name), objectClassGet(name), 1649 (short) LogSeverity._Error, 1650 "SNMP Error getting ifInUnknownProtos: " + e.reason); 1651 throw new ApplicationError (error_code); 1652 } 1653 1654 org.omg.CORBA.Any value = ifInUnknownProtosData.value; 1655 1656 if (value.type().kind().value() != TCKind._tk_longlong) { 1657 1658 ApplicationErrorInfoTypeImpl error_code = 1659 new ApplicationErrorInfoTypeImpl(); 1660 1661 error_code.error = new UIDType( 1662 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 1663 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 1664 1665 error_code.details = new String ("Could not retrieve ifInUnknownProtos " + 1666 "for LogicalInterface Object with name " + key + ":" + 1667 " Object with Snmp Object Identifier " + ifInUnknownProtosOid + 1668 " is not of type integer, as expected."); 1669 1670 throw new ApplicationError (error_code); 1671 1672 } 1673 1674 long ifInUnknownProtos = value.extract_longlong(); 1675 1676 return ifInUnknownProtos; 1677 } 1678 1684 public long 1685 ifOutOctetsGet(org.omg.CosNaming.NameComponent [] name) 1686 throws intt.itu.itut_x780.ApplicationError 1687 { 1688 String key = Utils.name2string(name); 1692 1693 if (elements.containsKey(key) == false) { 1694 ApplicationErrorInfoTypeImpl error_code = 1695 new ApplicationErrorInfoTypeImpl(); 1696 1697 error_code.error = new UIDType( 1698 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 1699 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 1700 1701 error_code.details = new String ("object with name " + 1702 key + " does not exist."); 1703 1704 throw new ApplicationError(error_code); 1705 } 1706 1707 LogicalInterfaceDataStructure data = 1708 (LogicalInterfaceDataStructure) elements.get(key); 1709 1710 int ifIndex = data.getifIndex(); 1711 1712 String ifOutOctetsOid = new String (IF_OUTOCTETS_OID + "." + ifIndex); 1713 1714 DataType ifOutOctetsData = null; 1715 1716 1718 try { 1719 ifOutOctetsData = connector.get( 1720 ifOutOctetsOid, 1721 new String (data.getMgmtIpAddress()), 1722 data.getSnmpPort(), 1723 READ_COMMUNITY); 1724 } 1725 catch (SnmpApplicationError e) { 1726 1727 ApplicationErrorInfoTypeImpl error_code = 1728 new ApplicationErrorInfoTypeImpl(); 1729 1730 error_code.error = new UIDType( 1731 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 1732 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 1733 1734 if (e.reason.equals(ExceptionMessages.agent_response_error)) 1735 error_code.details = ExceptionMessages.agent_response_error; 1736 else 1737 error_code.details = new String ("Could not retrieve ifOutOctets " + 1738 "for LogicalInterface Object with name " + key + ":" + 1739 " Object with Snmp Object Identifier " + ifOutOctetsOid + 1740 " does not exist."); 1741 1742 Utils.pretty_log(logSupport, Utils.name2string(name), objectClassGet(name), 1743 (short) LogSeverity._Error, 1744 "SNMP Error getting ifOutOctets: " + e.reason); 1745 throw new ApplicationError (error_code); 1746 } 1747 1748 org.omg.CORBA.Any value = ifOutOctetsData.value; 1749 1750 if (value.type().kind().value() != TCKind._tk_longlong) { 1751 1752 ApplicationErrorInfoTypeImpl error_code = 1753 new ApplicationErrorInfoTypeImpl(); 1754 1755 error_code.error = new UIDType( 1756 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 1757 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 1758 1759 error_code.details = new String ("Could not retrieve ifOutOctets " + 1760 "for LogicalInterface Object with name " + key + ":" + 1761 " Object with Snmp Object Identifier " + ifOutOctetsOid + 1762 " is not of type integer, as expected."); 1763 1764 throw new ApplicationError (error_code); 1765 1766 } 1767 1768 long ifOutOctets = value.extract_longlong(); 1769 1770 return ifOutOctets; 1771 } 1772 1778 public long 1779 ifOutUcastPktsGet(org.omg.CosNaming.NameComponent [] name) 1780 throws intt.itu.itut_x780.ApplicationError 1781 { 1782 String key = Utils.name2string(name); 1786 1787 if (elements.containsKey(key) == false) { 1788 ApplicationErrorInfoTypeImpl error_code = 1789 new ApplicationErrorInfoTypeImpl(); 1790 1791 error_code.error = new UIDType( 1792 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 1793 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 1794 1795 error_code.details = new String ("object with name " + 1796 key + " does not exist."); 1797 1798 throw new ApplicationError(error_code); 1799 } 1800 1801 LogicalInterfaceDataStructure data = 1802 (LogicalInterfaceDataStructure) elements.get(key); 1803 1804 int ifIndex = data.getifIndex(); 1805 1806 String ifOutUcastPktsOid = new String (IF_OUTUCASTPKTS_OID + "." + ifIndex); 1807 1808 DataType ifOutUcastPktsData = null; 1809 1810 1812 try { 1813 ifOutUcastPktsData = connector.get( 1814 ifOutUcastPktsOid, 1815 new String (data.getMgmtIpAddress()), 1816 data.getSnmpPort(), 1817 READ_COMMUNITY); 1818 } 1819 catch (SnmpApplicationError e) { 1820 1821 ApplicationErrorInfoTypeImpl error_code = 1822 new ApplicationErrorInfoTypeImpl(); 1823 1824 error_code.error = new UIDType( 1825 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 1826 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 1827 1828 if (e.reason.equals(ExceptionMessages.agent_response_error)) 1829 error_code.details = ExceptionMessages.agent_response_error; 1830 else 1831 error_code.details = new String ("Could not retrieve ifOutUcastPkts " + 1832 "for LogicalInterface Object with name " + key + ":" + 1833 " Object with Snmp Object Identifier " + ifOutUcastPktsOid + 1834 " does not exist."); 1835 1836 Utils.pretty_log(logSupport, Utils.name2string(name), objectClassGet(name), 1837 (short) LogSeverity._Error, 1838 "SNMP Error getting ifOutUcastPkts: " + e.reason); 1839 throw new ApplicationError (error_code); 1840 } 1841 1842 org.omg.CORBA.Any value = ifOutUcastPktsData.value; 1843 1844 if (value.type().kind().value() != TCKind._tk_longlong) { 1845 1846 ApplicationErrorInfoTypeImpl error_code = 1847 new ApplicationErrorInfoTypeImpl(); 1848 1849 error_code.error = new UIDType( 1850 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 1851 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 1852 1853 error_code.details = new String ("Could not retrieve ifOutUcastPkts " + 1854 "for LogicalInterface Object with name " + key + ":" + 1855 " Object with Snmp Object Identifier " + ifOutUcastPktsOid + 1856 " is not of type integer, as expected."); 1857 1858 throw new ApplicationError (error_code); 1859 1860 } 1861 1862 long ifOutUcastPkts = value.extract_longlong(); 1863 1864 return ifOutUcastPkts; 1865 } 1866 1872 public long 1873 ifOutNUcastPktsGet(org.omg.CosNaming.NameComponent [] name) 1874 throws intt.itu.itut_x780.ApplicationError, ist.coach.coachEmsMib.NOnonUcastPackageException 1875 { 1876 String key = Utils.name2string(name); 1880 1881 if (elements.containsKey(key) == false) { 1882 ApplicationErrorInfoTypeImpl error_code = 1883 new ApplicationErrorInfoTypeImpl(); 1884 1885 error_code.error = new UIDType( 1886 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 1887 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 1888 1889 error_code.details = new String ("object with name " + 1890 key + " does not exist."); 1891 1892 throw new ApplicationError(error_code); 1893 } 1894 1895 if (!Utils.packageIsSupported(NON_UCAST_PACKAGE, 1896 packagesGet(name))) { 1897 throw new ist.coach.coachEmsMib.NOnonUcastPackageException(); 1898 } 1899 1900 LogicalInterfaceDataStructure data = 1901 (LogicalInterfaceDataStructure) elements.get(key); 1902 1903 int ifIndex = data.getifIndex(); 1904 1905 String ifOutNUcastPktsOid = new String (IF_OUTNUCASTPKTS_OID + "." + ifIndex); 1906 1907 DataType ifOutNUcastPktsData = null; 1908 1909 1911 try { 1912 ifOutNUcastPktsData = connector.get( 1913 ifOutNUcastPktsOid, 1914 new String (data.getMgmtIpAddress()), 1915 data.getSnmpPort(), 1916 READ_COMMUNITY); 1917 } 1918 catch (SnmpApplicationError e) { 1919 1920 ApplicationErrorInfoTypeImpl error_code = 1921 new ApplicationErrorInfoTypeImpl(); 1922 1923 error_code.error = new UIDType( 1924 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 1925 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 1926 1927 if (e.reason.equals(ExceptionMessages.agent_response_error)) 1928 error_code.details = ExceptionMessages.agent_response_error; 1929 else 1930 error_code.details = new String ("Could not retrieve ifOutNUcastPkts " + 1931 "for LogicalInterface Object with name " + key + ":" + 1932 " Object with Snmp Object Identifier " + ifOutNUcastPktsOid + 1933 " does not exist."); 1934 1935 Utils.pretty_log(logSupport, Utils.name2string(name), objectClassGet(name), 1936 (short) LogSeverity._Error, 1937 "SNMP Error getting ifOutNUcastPkts: " + e.reason); 1938 throw new ApplicationError (error_code); 1939 } 1940 1941 org.omg.CORBA.Any value = ifOutNUcastPktsData.value; 1942 1943 if (value.type().kind().value() != TCKind._tk_longlong) { 1944 1945 ApplicationErrorInfoTypeImpl error_code = 1946 new ApplicationErrorInfoTypeImpl(); 1947 1948 error_code.error = new UIDType( 1949 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 1950 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 1951 1952 error_code.details = new String ("Could not retrieve ifOutNUcastPkts " + 1953 "for LogicalInterface Object with name " + key + ":" + 1954 " Object with Snmp Object Identifier " + ifOutNUcastPktsOid + 1955 " is not of type integer, as expected."); 1956 1957 throw new ApplicationError (error_code); 1958 1959 } 1960 1961 long ifOutNUcastPkts = value.extract_longlong(); 1962 1963 return ifOutNUcastPkts; 1964 } 1965 1971 public long 1972 ifOutDiscardsGet(org.omg.CosNaming.NameComponent [] name) 1973 throws intt.itu.itut_x780.ApplicationError 1974 { 1975 String key = Utils.name2string(name); 1979 1980 if (elements.containsKey(key) == false) { 1981 ApplicationErrorInfoTypeImpl error_code = 1982 new ApplicationErrorInfoTypeImpl(); 1983 1984 error_code.error = new UIDType( 1985 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 1986 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 1987 1988 error_code.details = new String ("object with name " + 1989 key + " does not exist."); 1990 1991 throw new ApplicationError(error_code); 1992 } 1993 1994 LogicalInterfaceDataStructure data = 1995 (LogicalInterfaceDataStructure) elements.get(key); 1996 1997 int ifIndex = data.getifIndex(); 1998 1999 String ifOutDiscardsOid = new String (IF_OUTDISCARDS_OID + "." + ifIndex); 2000 2001 DataType ifOutDiscardsData = null; 2002 2003 2005 try { 2006 ifOutDiscardsData = connector.get( 2007 ifOutDiscardsOid, 2008 new String (data.getMgmtIpAddress()), 2009 data.getSnmpPort(), 2010 READ_COMMUNITY); 2011 } 2012 catch (SnmpApplicationError e) { 2013 2014 ApplicationErrorInfoTypeImpl error_code = 2015 new ApplicationErrorInfoTypeImpl(); 2016 2017 error_code.error = new UIDType( 2018 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 2019 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 2020 2021 if (e.reason.equals(ExceptionMessages.agent_response_error)) 2022 error_code.details = ExceptionMessages.agent_response_error; 2023 else 2024 error_code.details = new String ("Could not retrieve ifOutDiscards " + 2025 "for LogicalInterface Object with name " + key + ":" + 2026 " Object with Snmp Object Identifier " + ifOutDiscardsOid + 2027 " does not exist."); 2028 2029 Utils.pretty_log(logSupport, Utils.name2string(name), objectClassGet(name), 2030 (short) LogSeverity._Error, 2031 "SNMP Error getting ifOutDiscards: " + e.reason); 2032 throw new ApplicationError (error_code); 2033 } 2034 2035 org.omg.CORBA.Any value = ifOutDiscardsData.value; 2036 2037 if (value.type().kind().value() != TCKind._tk_longlong) { 2038 2039 ApplicationErrorInfoTypeImpl error_code = 2040 new ApplicationErrorInfoTypeImpl(); 2041 2042 error_code.error = new UIDType( 2043 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 2044 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 2045 2046 error_code.details = new String ("Could not retrieve ifOutDiscards " + 2047 "for LogicalInterface Object with name " + key + ":" + 2048 " Object with Snmp Object Identifier " + ifOutDiscardsOid + 2049 " is not of type integer, as expected."); 2050 2051 throw new ApplicationError (error_code); 2052 2053 } 2054 2055 long ifOutDiscards = value.extract_longlong(); 2056 2057 return ifOutDiscards; 2058 } 2059 2065 public long 2066 ifOutErrorsGet(org.omg.CosNaming.NameComponent [] name) 2067 throws intt.itu.itut_x780.ApplicationError 2068 { 2069 String key = Utils.name2string(name); 2073 2074 if (elements.containsKey(key) == false) { 2075 ApplicationErrorInfoTypeImpl error_code = 2076 new ApplicationErrorInfoTypeImpl(); 2077 2078 error_code.error = new UIDType( 2079 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 2080 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 2081 2082 error_code.details = new String ("object with name " + 2083 key + " does not exist."); 2084 2085 throw new ApplicationError(error_code); 2086 } 2087 2088 LogicalInterfaceDataStructure data = 2089 (LogicalInterfaceDataStructure) elements.get(key); 2090 2091 int ifIndex = data.getifIndex(); 2092 2093 String ifOutErrorsOid = new String (IF_OUTERRORS_OID + "." + ifIndex); 2094 2095 DataType ifOutErrorsData = null; 2096 2097 2099 try { 2100 ifOutErrorsData = connector.get( 2101 ifOutErrorsOid, 2102 new String (data.getMgmtIpAddress()), 2103 data.getSnmpPort(), 2104 READ_COMMUNITY); 2105 } 2106 catch (SnmpApplicationError e) { 2107 2108 ApplicationErrorInfoTypeImpl error_code = 2109 new ApplicationErrorInfoTypeImpl(); 2110 2111 error_code.error = new UIDType( 2112 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 2113 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 2114 2115 if (e.reason.equals(ExceptionMessages.agent_response_error)) 2116 error_code.details = ExceptionMessages.agent_response_error; 2117 else 2118 error_code.details = new String ("Could not retrieve ifOutErrors " + 2119 "for LogicalInterface Object with name " + key + ":" + 2120 " Object with Snmp Object Identifier " + ifOutErrorsOid + 2121 " does not exist."); 2122 2123 Utils.pretty_log(logSupport, Utils.name2string(name), objectClassGet(name), 2124 (short) LogSeverity._Error, 2125 "SNMP Error getting ifOutErrors: " + e.reason); 2126 throw new ApplicationError (error_code); 2127 } 2128 2129 org.omg.CORBA.Any value = ifOutErrorsData.value; 2130 2131 if (value.type().kind().value() != TCKind._tk_longlong) { 2132 2133 ApplicationErrorInfoTypeImpl error_code = 2134 new ApplicationErrorInfoTypeImpl(); 2135 2136 error_code.error = new UIDType( 2137 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 2138 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 2139 2140 error_code.details = new String ("Could not retrieve ifOutErrors " + 2141 "for LogicalInterface Object with name " + key + ":" + 2142 " Object with Snmp Object Identifier " + ifOutErrorsOid + 2143 " is not of type integer, as expected."); 2144 2145 throw new ApplicationError (error_code); 2146 2147 } 2148 2149 long ifOutErrors = value.extract_longlong(); 2150 2151 return ifOutErrors; 2152 } 2153 2159 public long 2160 ifOutQLenGet(org.omg.CosNaming.NameComponent [] name) 2161 throws intt.itu.itut_x780.ApplicationError 2162 { 2163 String key = Utils.name2string(name); 2167 2168 if (elements.containsKey(key) == false) { 2169 ApplicationErrorInfoTypeImpl error_code = 2170 new ApplicationErrorInfoTypeImpl(); 2171 2172 error_code.error = new UIDType( 2173 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 2174 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 2175 2176 error_code.details = new String ("object with name " + 2177 key + " does not exist."); 2178 2179 throw new ApplicationError(error_code); 2180 } 2181 2182 LogicalInterfaceDataStructure data = 2183 (LogicalInterfaceDataStructure) elements.get(key); 2184 2185 int ifIndex = data.getifIndex(); 2186 2187 String ifOutQLenOid = new String (IF_OUTQLEN_OID + "." + ifIndex); 2188 2189 DataType ifOutQLenData = null; 2190 2191 2193 try { 2194 ifOutQLenData = connector.get( 2195 ifOutQLenOid, 2196 new String (data.getMgmtIpAddress()), 2197 data.getSnmpPort(), 2198 READ_COMMUNITY); 2199 } 2200 catch (SnmpApplicationError e) { 2201 2202 ApplicationErrorInfoTypeImpl error_code = 2203 new ApplicationErrorInfoTypeImpl(); 2204 2205 error_code.error = new UIDType( 2206 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 2207 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 2208 2209 if (e.reason.equals(ExceptionMessages.agent_response_error)) 2210 error_code.details = ExceptionMessages.agent_response_error; 2211 else 2212 error_code.details = new String ("Could not retrieve ifOutQLen " + 2213 "for LogicalInterface Object with name " + key + ":" + 2214 " Object with Snmp Object Identifier " + ifOutQLenOid + 2215 " does not exist."); 2216 2217 Utils.pretty_log(logSupport, Utils.name2string(name), objectClassGet(name), 2218 (short) LogSeverity._Error, 2219 "SNMP Error getting ifOutQLen: " + e.reason); 2220 throw new ApplicationError (error_code); 2221 } 2222 2223 org.omg.CORBA.Any value = ifOutQLenData.value; 2224 2225 if (value.type().kind().value() != TCKind._tk_longlong) { 2226 2227 ApplicationErrorInfoTypeImpl error_code = 2228 new ApplicationErrorInfoTypeImpl(); 2229 2230 error_code.error = new UIDType( 2231 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 2232 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 2233 2234 error_code.details = new String ("Could not retrieve ifOutQLen " + 2235 "for LogicalInterface Object with name " + key + ":" + 2236 " Object with Snmp Object Identifier " + ifOutQLenOid + 2237 " is not of type integer, as expected."); 2238 2239 throw new ApplicationError (error_code); 2240 2241 } 2242 2243 long ifOutQLen = value.extract_longlong(); 2244 2245 return ifOutQLen; 2246 } 2247 2253 public java.lang.String 2254 ifSpecificGet(org.omg.CosNaming.NameComponent [] name) 2255 throws intt.itu.itut_x780.ApplicationError 2256 { 2257 String key = Utils.name2string(name); 2261 2262 if (elements.containsKey(key) == false) { 2263 ApplicationErrorInfoTypeImpl error_code = 2264 new ApplicationErrorInfoTypeImpl(); 2265 2266 error_code.error = new UIDType( 2267 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 2268 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 2269 2270 error_code.details = new String ("object with name " + 2271 key + " does not exist."); 2272 2273 throw new ApplicationError(error_code); 2274 } 2275 2276 LogicalInterfaceDataStructure data = 2277 (LogicalInterfaceDataStructure) elements.get(key); 2278 2279 int ifIndex = data.getifIndex(); 2280 2281 String ifSpecificOid = new String (IF_SPECIFIC_OID + "." + ifIndex); 2282 2283 DataType ifSpecificData = null; 2284 2285 2287 try { 2288 ifSpecificData = connector.get( 2289 ifSpecificOid, 2290 new String (data.getMgmtIpAddress()), 2291 data.getSnmpPort(), 2292 READ_COMMUNITY); 2293 } 2294 catch (SnmpApplicationError e) { 2295 2296 ApplicationErrorInfoTypeImpl error_code = 2297 new ApplicationErrorInfoTypeImpl(); 2298 2299 error_code.error = new UIDType( 2300 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 2301 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 2302 2303 if (e.reason.equals(ExceptionMessages.agent_response_error)) 2304 error_code.details = ExceptionMessages.agent_response_error; 2305 else 2306 error_code.details = new String ("Could not retrieve ifSpecific " + 2307 "for LogicalInterface Object with name " + key + ":" + 2308 " Object with Snmp Object Identifier " + ifSpecificOid + 2309 " does not exist."); 2310 2311 Utils.pretty_log(logSupport, Utils.name2string(name), objectClassGet(name), 2312 (short) LogSeverity._Error, 2313 "SNMP Error getting ifSpecific: " + e.reason); 2314 throw new ApplicationError (error_code); 2315 } 2316 2317 org.omg.CORBA.Any value = ifSpecificData.value; 2318 2319 if (value.type().kind().value() != TCKind._tk_string) { 2320 2321 ApplicationErrorInfoTypeImpl error_code = 2322 new ApplicationErrorInfoTypeImpl(); 2323 2324 error_code.error = new UIDType( 2325 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 2326 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 2327 2328 error_code.details = new String ("Could not retrieve ifSpecific " + 2329 "for LogicalInterface Object with name " + key + ":" + 2330 " Object with Snmp Object Identifier " + ifSpecificOid + 2331 " is not of type string, as expected."); 2332 2333 throw new ApplicationError (error_code); 2334 2335 } 2336 2337 String ifSpecific = value.extract_string(); 2338 2339 return ifSpecific; 2340 } 2341 2347 public org.omg.CosNaming.NameComponent [][] 2348 supportedByObjectListGet(org.omg.CosNaming.NameComponent [] name) 2349 throws intt.itu.itut_x780.ApplicationError 2350 { 2351 String key = Utils.name2string(name); 2355 2356 if (elements.containsKey(key) == false) { 2357 ApplicationErrorInfoTypeImpl error_code = 2358 new ApplicationErrorInfoTypeImpl(); 2359 2360 error_code.error = new UIDType( 2361 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 2362 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 2363 2364 error_code.details = new String ("object with name " + 2365 key + " does not exist."); 2366 2367 throw new ApplicationError(error_code); 2368 } 2369 2370 return new org.omg.CosNaming.NameComponent [0][0]; 2371 2372 } 2373 2379 public intt.itu.itut_x780.OperationalStateType 2380 operationalStateGet(org.omg.CosNaming.NameComponent [] name) 2381 throws intt.itu.itut_x780.ApplicationError, intt.itu.itut_m3120.NOoperationalStatePackageException 2382 { 2383 2387 String key = Utils.name2string(name); 2388 2389 if (elements.containsKey(key) == false) { 2390 ApplicationErrorInfoTypeImpl error_code = 2391 new ApplicationErrorInfoTypeImpl(); 2392 2393 error_code.error = new UIDType( 2394 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 2395 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 2396 2397 error_code.details = new String ("object with name " + 2398 key + " does not exist."); 2399 2400 throw new ApplicationError(error_code); 2401 } 2402 2403 if (!Utils.packageIsSupported(OPERATIONAL_STATE_PACKAGE, 2404 packagesGet(name))) { 2405 throw new intt.itu.itut_m3120.NOoperationalStatePackageException(); 2406 } 2407 2408 LogicalInterfaceDataStructure data = 2409 (LogicalInterfaceDataStructure) elements.get(key); 2410 2411 int ifIndex = data.getifIndex(); 2412 2413 String ifOperStatusOid = new String (IF_OPERSTATUS_OID + "." + ifIndex); 2414 2415 DataType ifOperStatusData = null; 2416 2417 2419 try { 2420 ifOperStatusData = connector.get( 2421 ifOperStatusOid, 2422 new String (data.getMgmtIpAddress()), 2423 data.getSnmpPort(), 2424 READ_COMMUNITY); 2425 } 2426 catch (SnmpApplicationError e) { 2427 2428 ApplicationErrorInfoTypeImpl error_code = 2429 new ApplicationErrorInfoTypeImpl(); 2430 2431 error_code.error = new UIDType( 2432 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 2433 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 2434 2435 if (e.reason.equals(ExceptionMessages.agent_response_error)) 2436 error_code.details = ExceptionMessages.agent_response_error; 2437 else 2438 error_code.details = new String ("Could not retrieve Operational State " + 2439 "for LogicalInterface Object with name " + key + ":" + 2440 " Object with Snmp Object Identifier " + ifOperStatusOid + 2441 " does not exist."); 2442 2443 Utils.pretty_log(logSupport, Utils.name2string(name), objectClassGet(name), 2444 (short) LogSeverity._Error, 2445 "SNMP Error getting Operational State: " + e.reason); 2446 throw new ApplicationError (error_code); 2447 } 2448 2449 org.omg.CORBA.Any value = ifOperStatusData.value; 2450 2451 if (value.type().kind().value() != TCKind._tk_long) { 2452 2453 ApplicationErrorInfoTypeImpl error_code = 2454 new ApplicationErrorInfoTypeImpl(); 2455 2456 error_code.error = new UIDType( 2457 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 2458 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 2459 2460 error_code.details = new String ("Could not retrieve Operational State " + 2461 "for LogicalInterface Object with name " + key + ":" + 2462 " Object with Snmp Object Identifier " + ifOperStatusOid + 2463 " is not of type integer, as expected."); 2464 2465 throw new ApplicationError (error_code); 2466 2467 } 2468 2469 int ifOperStatusInt = value.extract_long(); 2470 OperationalStateType operationalState = null; 2471 2472 if (ifOperStatusInt == LogicalInterface_F.up || 2473 ifOperStatusInt == LogicalInterface_F.testing) 2474 operationalState = OperationalStateType.enabled; 2475 else 2476 operationalState = OperationalStateType.disabled; 2477 2478 return operationalState; 2479 } 2480 2486 public org.omg.CosNaming.NameComponent [] 2487 nameGet() 2488 { 2489 return Utils.string2name(_facade_name); 2493 } 2494 2500 public java.lang.String 2501 objectClassGet(org.omg.CosNaming.NameComponent [] name) 2502 throws intt.itu.itut_x780.ApplicationError 2503 { 2504 2508 String key = Utils.name2string(name); 2509 2510 if (elements.containsKey(key) == false) { 2511 ApplicationErrorInfoTypeImpl error_code = 2512 new ApplicationErrorInfoTypeImpl(); 2513 2514 error_code.error = new UIDType( 2515 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 2516 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 2517 2518 error_code.details = new String ("object with name " + 2519 key + " does not exist."); 2520 2521 throw new ApplicationError(error_code); 2522 } 2523 2524 LogicalInterfaceDataStructure data = 2525 (LogicalInterfaceDataStructure) elements.get(key); 2526 2527 return data.getObjectClass(); 2528 } 2529 2530 2536 public intt.itu.itut_x780.ManagedObjectValueType 2537 attributesGet(org.omg.CosNaming.NameComponent [] name, intt.itu.itut_x780.StringSetTypeHolder attributeNames) 2538 throws intt.itu.itut_x780.ApplicationError 2539 { 2540 2544 String key = Utils.name2string(name); 2545 2546 if (elements.containsKey(key) == false) { 2547 ApplicationErrorInfoTypeImpl error_code = 2548 new ApplicationErrorInfoTypeImpl(); 2549 2550 error_code.error = new UIDType( 2551 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 2552 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 2553 2554 error_code.details = new String ("object with name " + 2555 key + " does not exist."); 2556 2557 throw new ApplicationError(error_code); 2558 } 2559 2560 LogicalInterfaceDataStructure data = 2561 (LogicalInterfaceDataStructure) elements.get(key); 2562 2563 long ifLastChange = -1; 2564 OperationalStateType operationalState = OperationalStateType.enabled; 2565 long ifInNUcastPkts = -1; 2566 long ifOutNUcastPkts = -1; 2567 long ifInUnknownProtos = -1; 2568 2569 try { 2570 ifInNUcastPkts = ifInNUcastPktsGet(name); 2571 } 2572 catch (ist.coach.coachEmsMib.NOnonUcastPackageException nonUcastPackage) { 2573 } 2574 2575 try { 2576 ifOutNUcastPkts = ifOutNUcastPktsGet(name); 2577 } 2578 catch (ist.coach.coachEmsMib.NOnonUcastPackageException nonUcastPackage) { 2579 } 2580 2581 try { 2582 ifInUnknownProtos = ifInUnknownProtosGet(name); 2583 } 2584 catch (ist.coach.coachEmsMib.NOunknownProtosPackageException unknownProtosPackage) { 2585 } 2586 2587 try { 2588 ifLastChange = ifLastChangeGet(name); 2589 } 2590 catch (ist.coach.coachEmsMib.NOifLastChangePackageException noIfLastChange) { 2591 } 2594 2595 try { 2596 operationalState = operationalStateGet(name); 2597 } 2598 catch (intt.itu.itut_m3120.NOoperationalStatePackageException noOperationalState) { 2599 } 2600 2601 LogicalInterfaceValueTypeImpl logicalInterfaceValueType = 2602 new LogicalInterfaceValueTypeImpl( 2603 2604 supportedByObjectListGet(name), 2605 operationalState, 2606 2607 data.getifIndex(), 2608 ifDescrGet(name), 2609 ifTypeGet(name), 2610 ifMtuGet(name), 2611 ifSpeedGet(name), 2612 ifPhysAddressGet(name), 2613 ifAdminStatusGet(name), 2614 ifLastChange, 2615 ifInOctetsGet(name), 2616 ifInUcastPktsGet(name), 2617 ifInNUcastPkts, 2618 ifInErrorsGet(name), 2619 ifInUnknownProtos, 2620 ifOutOctetsGet(name), 2621 ifOutUcastPktsGet(name), 2622 ifOutNUcastPkts, 2623 ifOutDiscardsGet(name), 2624 ifOutErrorsGet(name), 2625 ifOutQLenGet(name), 2626 ifSpecificGet(name), 2627 2628 data.getName(), 2629 data.getObjectClass(), 2630 data.getPackages(), 2631 data.getSourceIndicator(), 2632 data.getDeletePolicy() 2633 ); 2634 Utils.pretty_log(logSupport, Utils.name2string(name), objectClassGet(name), 2635 (short) LogSeverity._Info, 2636 "attributesGet finished successfully"); 2637 return logicalInterfaceValueType; 2638 2639 } 2640 2646 public java.lang.String [] 2647 packagesGet(org.omg.CosNaming.NameComponent [] name) 2648 throws intt.itu.itut_x780.ApplicationError 2649 { 2650 2654 String key = Utils.name2string(name); 2655 2656 if (elements.containsKey(key) == false) { 2657 ApplicationErrorInfoTypeImpl error_code = 2658 new ApplicationErrorInfoTypeImpl(); 2659 2660 error_code.error = new UIDType( 2661 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 2662 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 2663 2664 error_code.details = new String ("object with name " + 2665 key + " does not exist."); 2666 2667 throw new ApplicationError(error_code); 2668 } 2669 2670 LogicalInterfaceDataStructure data = 2671 (LogicalInterfaceDataStructure) elements.get(key); 2672 2673 return data.getPackages(); 2674 } 2675 2681 public intt.itu.itut_x780.SourceIndicatorType 2682 creationSourceGet(org.omg.CosNaming.NameComponent [] name) 2683 throws intt.itu.itut_x780.ApplicationError 2684 { 2685 String key = Utils.name2string(name); 2689 2690 if (elements.containsKey(key) == false) { 2691 ApplicationErrorInfoTypeImpl error_code = 2692 new ApplicationErrorInfoTypeImpl(); 2693 2694 error_code.error = new UIDType( 2695 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 2696 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 2697 2698 error_code.details = new String ("object with name " + 2699 key + " does not exist."); 2700 2701 throw new ApplicationError(error_code); 2702 } 2703 2704 LogicalInterfaceDataStructure data = 2705 (LogicalInterfaceDataStructure) elements.get(key); 2706 2707 return data.getSourceIndicator(); 2708 } 2709 2715 public short 2716 deletePolicyGet(org.omg.CosNaming.NameComponent [] name) 2717 throws intt.itu.itut_x780.ApplicationError 2718 { 2719 2723 String key = Utils.name2string(name); 2724 2725 if (elements.containsKey(key) == false) { 2726 ApplicationErrorInfoTypeImpl error_code = 2727 new ApplicationErrorInfoTypeImpl(); 2728 2729 error_code.error = new UIDType( 2730 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 2731 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 2732 2733 error_code.details = new String ("object with name " + 2734 key + " does not exist."); 2735 2736 throw new ApplicationError(error_code); 2737 } 2738 2739 LogicalInterfaceDataStructure data = 2740 (LogicalInterfaceDataStructure) elements.get(key); 2741 2742 return data.getDeletePolicy(); 2743 } 2744 2750 public void 2751 destroy(org.omg.CosNaming.NameComponent [] name) 2752 throws intt.itu.itut_x780.ApplicationError, intt.itu.itut_x780.DeleteError 2753 { 2754 2758 if (!elements.containsKey(Utils.name2string(name))) { 2759 2760 ApplicationErrorInfoTypeImpl error_code = 2761 new ApplicationErrorInfoTypeImpl(); 2762 2763 error_code.error = new UIDType( 2764 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 2765 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 2766 2767 error_code.details = new String ("object with name " + 2768 Utils.name2string(name) + " does not exist."); 2769 2770 throw new ApplicationError(error_code); 2771 2772 } 2773 2774 LogicalInterfaceDataStructure logicalInterfaceData = null; 2775 synchronized(elements) { 2776 logicalInterfaceData = 2777 (LogicalInterfaceDataStructure) elements.remove( 2778 Utils.name2string(name)); 2779 } 2780 try { 2781 config.unregister(name); 2782 } 2783 catch (ist.coach.coachEmfServices.SnmpAdapter.SnmpApplicationError snmp_e) { 2784 System.err.println("There was a problem unregistering " + Utils.name2string(name) + 2785 "from the SNMP Trap Daemon"); 2786 Utils.pretty_log(logSupport, Utils.name2string(name), 2787 logicalInterfaceData.objectclass, (short) LogSeverity._Error, 2789 "SNMP Error unregistering from the SNMP Trap Deamon: " + snmp_e.reason); 2790 } 2791 2792 org.omg.TimeBase.UtcT eventTime = new org.omg.TimeBase.UtcT(System.currentTimeMillis(), 2793 0, (short) 0, (short) 0); 2794 get_context().push_objectDeletion(new ObjectDeletionImpl(eventTime, name, 2795 logicalInterfaceData.objectclass, 2796 getUniqueNotificationIdentifier(), 2797 logicalInterfaceData.sourceIndicator, 2799 new AttributeValueType[0])); 2800 Utils.pretty_log(logSupport, Utils.name2string(name), 2801 logicalInterfaceData.objectclass, (short) LogSeverity._Info, 2803 "successfully removed from management system"); 2804 } 2805 2811 2812 public static int getUniqueNotificationIdentifier() { 2813 2814 notifId++; 2815 2816 return (notifId); 2817 } 2818 2819 2820} 2821 | Popular Tags |